:root { 
  /* Poodle-inspired color palette */
  --bg: #fdf2f8; /* soft pink background */
  --card: #ffffff; /* clean white cards */
  --card-border: #f3e8ff; /* light purple border */
  --muted: #9f7aea; /* medium purple for muted text */
  --ink: #4a5568; /* dark gray for main text */
  --pri: #ed64a6; /* bright pink primary */
  --accent: #d53f8c; /* deeper pink accent */
  --danger: #e53e3e; /* soft red for danger */
  --success: #38a169; /* soft green */
  --header-bg: #ffffff; /* white header */
  --shadow: rgba(237, 100, 166, 0.1); /* pink shadow */
  --gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%); /* pink gradient */
}

/* Dark theme */
[data-theme="dark"] {
  --bg: #1a1625;
  --card: #2d2640;
  --card-border: #3d3555;
  --muted: #b794d6;
  --ink: #e8e0f0;
  --pri: #f687b3;
  --accent: #ed64a6;
  --danger: #fc8181;
  --success: #68d391;
  --header-bg: #2d2640;
  --shadow: rgba(246, 135, 179, 0.12);
}

[data-theme="dark"] body {
  background-image:
    radial-gradient(circle at 20% 80%, rgba(237, 100, 166, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(213, 63, 140, 0.08) 0%, transparent 50%);
}

[data-theme="dark"] .cell.slot .label {
  color: var(--ink);
}

[data-theme="dark"] .cell.slot .counts {
  background: rgba(45, 38, 64, 0.9);
  color: var(--ink);
}

[data-theme="dark"] .site-footer .wallet-row {
  color: var(--muted);
}

[data-theme="dark"] #closed-banner {
  background: linear-gradient(135deg, #4a2020, #5a2020);
  border-color: #7a3030;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.5 'Segoe UI', system-ui, -apple-system, sans-serif;
  min-height: 100vh;
}

body {
  background-image: 
    radial-gradient(circle at 20% 80%, rgba(237, 100, 166, 0.05) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(213, 63, 140, 0.05) 0%, transparent 50%);
}

a {
  color: var(--pri);
  text-decoration: none;
  transition: all 0.2s ease;
}

a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 16px;
}

.topbar {
  position: sticky;
  top: 0;
  background: var(--header-bg);
  backdrop-filter: blur(10px);
  border-bottom: 2px solid var(--card-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  z-index: 10;
  box-shadow: 0 2px 10px var(--shadow);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 0.5px;
  color: var(--pri);
}

.brand .logo {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px var(--shadow);
}

.nav a {
  margin-left: 20px;
  padding: 8px 16px;
  border-radius: 20px;
  transition: all 0.2s ease;
  font-weight: 500;
}

.nav a:hover {
  background: var(--card-border);
  text-decoration: none;
}

.card {
  background: var(--card);
  border: 2px solid var(--card-border);
  border-radius: 16px;
  padding: 24px;
  margin: 24px 0;
  box-shadow: 0 4px 20px var(--shadow);
  transition: all 0.2s ease;
}

.card:hover {
  box-shadow: 0 6px 25px var(--shadow);
  transform: translateY(-1px);
}

h1 {
  margin: 0.2rem 0 1.5rem;
  font-size: 2rem;
  font-weight: 700;
  color: var(--pri);
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

h2 {
  margin: 0 0 1rem;
  font-size: 1.4rem;
  color: var(--pri);
  font-weight: 600;
}

h3 {
  margin: 1rem 0 0.6rem;
  font-size: 1.1rem;
  color: var(--accent);
  font-weight: 600;
}

label {
  display: block;
  margin: 0.8rem 0;
  font-weight: 500;
  color: var(--ink);
}

input[type=text],
input[type=email],
input[type=date],
input[type=time],
input[type=number],
textarea,
select {
  width: 100%;
  padding: 12px 16px;
  border-radius: 12px;
  border: 2px solid var(--card-border);
  background: var(--card);
  color: var(--ink);
  font-size: 14px;
  transition: all 0.2s ease;
}

input[type=text]:focus,
input[type=email]:focus,
input[type=date]:focus,
input[type=time]:focus,
input[type=number]:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--pri);
  box-shadow: 0 0 0 3px rgba(237, 100, 166, 0.1);
}

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

.btn {
  display: inline-block;
  padding: 10px 20px;
  background: var(--card);
  border: 2px solid var(--card-border);
  color: var(--ink);
  border-radius: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn:hover {
  background: var(--card-border);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px var(--shadow);
}

.btn.primary {
  background: var(--gradient);
  border-color: var(--pri);
  color: white;
  font-weight: 600;
}

.btn.primary:hover {
  background: var(--accent);
  border-color: var(--accent);
}

.btn.small {
  padding: 6px 12px;
  font-size: 0.85rem;
}

.btn.danger {
  background: var(--danger);
  border-color: var(--danger);
  color: white;
}

.btn.danger:hover {
  background: #c53030;
  border-color: #c53030;
}

.actions {
  margin-top: 1.5rem;
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.divider {
  height: 2px;
  background: var(--gradient);
  margin: 20px 0;
  border-radius: 1px;
  opacity: 0.3;
}

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

.small {
  font-size: 0.9em;
}

.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.grid4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

@media (max-width: 800px) { 
  .grid2, .grid4 { 
    grid-template-columns: 1fr; 
  }
  
  .topbar {
    flex-direction: column;
    gap: 12px;
    padding: 16px;
  }
  
  .brand .logo {
    width: 35px;
    height: 35px;
  }
}

.grid-row .cell.head {
  font-size: 0.8rem;
  line-height: 1.3;
  white-space: normal;
  text-align: center;
  font-weight: 600;
  color: var(--pri);
}

.cell.slot {
  position: relative;
  transition: all 0.2s ease;
}

.cell.slot:hover {
  transform: scale(1.02);
}

.cell.slot .counts {
  position: absolute;
  right: 6px;
  bottom: 4px;
  font-size: 0.70rem;
  opacity: 0.8;
  pointer-events: none;
  background: rgba(255, 255, 255, 0.9);
  padding: 2px 4px;
  border-radius: 4px;
  font-weight: 500;
}

.cell.slot .label {
  display: inline-block;
  font-weight: 600;
  color: #2d3748;
  text-shadow: none;
}

.table .head {
  white-space: normal;
}

.table-wrap {
  overflow: auto;
  border-radius: 12px;
  border: 2px solid var(--card-border);
}

.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
}

.table th, .table td {
  border-bottom: 1px solid var(--card-border);
  padding: 12px;
  text-align: left;
  white-space: nowrap;
}

.table th {
  background: var(--card-border);
  font-weight: 600;
  color: var(--pri);
}

.event-head {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.legend {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 1rem 0;
  padding: 12px;
  background: var(--card-border);
  border-radius: 12px;
}

.legend .grad {
  height: 16px;
  flex: 1;
  background: linear-gradient(90deg, 
    hsl(120, 70%, 60%), 
    hsl(60, 70%, 60%), 
    hsl(0, 70%, 60%)
  );
  border-radius: 8px;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

.grid {
  display: block;
  overflow: auto;
  border: 2px solid var(--card-border);
  border-radius: 16px;
  background: var(--card);
}

.grid-row {
  display: grid;
  grid-template-columns: 220px repeat(auto-fit, minmax(110px, 1fr));
  border-bottom: 1px solid var(--card-border);
}

.grid-row:last-child {
  border-bottom: none;
}

.grid-row .cell {
  padding: 12px;
  border-right: 1px solid var(--card-border);
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.grid-row .cell:last-child {
  border-right: none;
}

.grid-row .cell.head {
  background: var(--card-border);
  font-weight: 600;
  color: var(--pri);
}

.grid-row .cell.first {
  position: sticky;
  left: 0;
  background: var(--card-border);
  z-index: 2;
  font-weight: 600;
  color: var(--pri);
}

.grid-row .cell.sticky {
  position: sticky;
  left: 0;
  background: var(--card);
  font-weight: 600;
  z-index: 2;
  text-align: left;
  justify-content: flex-start;
  border-right: 2px solid var(--card-border);
  color: var(--ink);
}

.cell.slot {
  cursor: pointer;
  border: 2px solid transparent;
  border-radius: 8px;
  margin: 2px;
  font-weight: 500;
}

.cell.slot:hover {
  border-color: var(--pri);
}

.cell.slot.selected {
  outline: 2px solid var(--pri);
  outline-offset: 2px;
}

.cell.slot.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.cell.empty {
  background: var(--card-border);
  opacity: 0.3;
}

.voteform textarea {
  margin-top: 12px;
}

/* Slot builder styles */
.slot-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 12px 0;
  padding: 16px;
  padding-right: 70px;          /* room for the Remove button */
  background: var(--card-border);
  border-radius: 12px;
  position: relative;
}

.slot-remove-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 4px 8px;
}

/* Status banners */
#closed-banner {
  background: linear-gradient(135deg, #fed7d7, #feb2b2);
  color: #c53030;
  text-align: center;
  font-weight: 600;
  padding: 12px;
  border: 2px solid #fbb6ce;
}

/* Comments section */
#owner-comments {
  background: var(--card-border);
}

#owner-comments ul li {
  background: var(--card);
  margin: 8px 0;
  padding: 12px;
  border-radius: 8px;
  border-left: 4px solid var(--pri);
}

/* Form improvements */
.form-section {
  margin: 24px 0;
}

.form-section:first-child {
  margin-top: 0;
}

/* Loading and status styles */
#save-status {
  font-style: italic;
  color: var(--muted);
}

#vote-closed {
  color: var(--danger);
  font-weight: 600;
}

/* Mobile date navigator */
.mobile-date-nav {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 10px 12px;
  background: var(--card-border);
  border-radius: 12px;
  margin-bottom: 8px;
}

.mobile-date-nav .date-label {
  font-weight: 700;
  font-size: 1rem;
  color: var(--pri);
  min-width: 140px;
  text-align: center;
}

/* Right-click context menu */
.ctx-menu {
  position: fixed;
  background: var(--card);
  border: 2px solid var(--card-border);
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.18);
  z-index: 1100;
  min-width: 240px;
  padding: 6px 0;
  display: none;
}

.ctx-menu.open {
  display: block;
}

.ctx-menu .ctx-header {
  padding: 8px 16px 4px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.ctx-menu .ctx-divider {
  height: 1px;
  background: var(--card-border);
  margin: 4px 0;
}

.ctx-menu .ctx-item {
  display: block;
  width: 100%;
  padding: 10px 16px;
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 0.9rem;
  color: var(--ink);
  border: none;
  background: none;
  text-align: left;
  font-family: inherit;
  line-height: 1.4;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  outline: none;
  border-radius: 0;
}

.ctx-menu .ctx-item:hover {
  background: var(--card-border);
  color: var(--pri);
  padding-left: 20px;
}

/* Tip callout box */
.tip-callout {
  background: linear-gradient(135deg, #fdf2f8, #f3e8ff);
  border: 2px solid var(--pri);
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 12px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.5;
}

.tip-callout strong {
  color: var(--pri);
}

/* Donation footer */
.site-footer {
  margin-top: 40px;
  padding: 24px 16px;
  border-top: 2px solid var(--card-border);
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.6;
}

.site-footer .donate-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 16px;
  margin-top: 8px;
}

.site-footer .donate-row a {
  color: var(--pri);
  font-weight: 500;
}

.site-footer .wallet-row {
  margin-top: 8px;
  font-size: 0.7rem;
  color: #a0aec0;
  word-break: break-all;
}

/* Theme toggle */
.theme-toggle {
  background: none;
  border: 2px solid var(--card-border);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: all 0.2s ease;
  color: var(--ink);
  flex-shrink: 0;
}

.theme-toggle:hover {
  border-color: var(--pri);
  background: var(--card-border);
}

/* Timezone selector on event pages */
.tz-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0;
  font-size: 0.85rem;
  flex-wrap: wrap;
}

.tz-bar label {
  display: inline;
  margin: 0;
  font-weight: 600;
  color: var(--muted);
  font-size: 0.85rem;
}

.tz-bar select {
  width: auto;
  padding: 4px 8px;
  font-size: 0.85rem;
  border-radius: 8px;
}

/* Responsive adjustments */
@media (max-width: 600px) {
  .container {
    padding: 16px 12px;
  }

  .card {
    padding: 16px;
    margin: 16px 0;
  }

  .event-head {
    flex-direction: column;
    gap: 12px;
  }

  .grid-row .cell {
    padding: 8px;
    min-height: 44px;
  }

  .mobile-date-nav {
    display: flex;
  }

  /* Stack slot rows vertically on mobile */
  .slot-row {
    grid-template-columns: 1fr;
    padding-right: 16px;
    padding-top: 40px;           /* room for Remove button at top */
  }

  .slot-row label,
  .slot-row input {
    min-width: 0;
    max-width: 100%;
  }

  .slot-remove-btn {
    top: 8px;
    right: 8px;
  }
}