:root {
  --bg: #f3eadf;
  --panel: rgba(255, 249, 239, 0.94);
  --panel-border: rgba(84, 55, 25, 0.14);
  --text: #2d2217;
  --muted: #705845;
  --primary: #914a27;
  --primary-strong: #6e3418;
  --danger: #8d2f2f;
  --success: #45613c;
  --shadow: 0 20px 45px rgba(80, 53, 20, 0.15);
  --radius: 22px;
}

* {
  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, rgba(255, 240, 214, 0.85), transparent 38%),
    linear-gradient(160deg, var(--bg) 0%, #e8ddcb 48%, #d7c1a4 100%);
}

button,
input,
select,
a {
  font: inherit;
}

.page-shell {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2rem 0 3rem;
}

.hero {
  padding: 2rem;
  margin-bottom: 1.5rem;
  border-radius: calc(var(--radius) + 8px);
  background:
    linear-gradient(135deg, rgba(71, 42, 20, 0.92), rgba(146, 86, 45, 0.82)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160' viewBox='0 0 160 160'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23f7e9ce' fill-opacity='.08'%3E%3Cpath d='M80 0 96 48l48 16-48 16-16 48-16-48L16 64l48-16z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  color: #fff4e8;
  box-shadow: var(--shadow);
}

.eyebrow,
h1,
h2,
h3 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
}

.eyebrow {
  margin-bottom: 0.6rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 0.82rem;
  opacity: 0.84;
}

h1 {
  font-size: clamp(2.4rem, 6vw, 4.4rem);
  line-height: 1.04;
}

.hero-copy {
  max-width: 52rem;
  margin: 1rem 0 0;
  color: rgba(255, 244, 232, 0.88);
  font-size: 1.08rem;
}

.page-grid {
  display: grid;
  gap: 1.5rem;
}

.page-grid-host {
  grid-template-columns: 1.2fr 1fr;
}

.page-grid-host .panel:last-child {
  grid-column: 1 / -1;
}

.page-grid-vote,
.page-grid-results {
  grid-template-columns: minmax(0, 1fr);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 1.35rem;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}

.panel-heading {
  margin-bottom: 1rem;
}

.panel-heading p,
.summary-label,
small {
  color: var(--muted);
}

.stack {
  display: grid;
  gap: 1rem;
}

.field {
  display: grid;
  gap: 0.45rem;
}

.field span {
  font-weight: 700;
}

input,
select {
  width: 100%;
  border: 1px solid rgba(113, 82, 52, 0.18);
  background: rgba(255, 255, 255, 0.85);
  padding: 0.85rem 0.95rem;
  color: var(--text);
  border-radius: 14px;
}

button,
.button-link {
  border: 0;
  border-radius: 14px;
  padding: 0.9rem 1.2rem;
  background: #e7d7c4;
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 160ms ease, background 160ms ease;
}

button:hover,
.button-link:hover {
  transform: translateY(-1px);
  background: #dcc7af;
}

button.primary {
  background: var(--primary);
  color: #fff7ef;
}

button.primary:hover {
  background: var(--primary-strong);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
  transform: none;
}

button.danger {
  background: rgba(141, 47, 47, 0.12);
  color: var(--danger);
}

.button-row,
.link-actions,
.copy-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.copy-row input {
  flex: 1;
  min-width: 0;
}

.calendar-toolbar {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.calendar-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.calendar-month {
  padding: 1rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(113, 82, 52, 0.12);
}

.calendar-month h3 {
  margin-bottom: 0.85rem;
  font-size: 1.1rem;
}

.calendar-weekdays,
.calendar-days {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.35rem;
}

.calendar-weekdays {
  margin-bottom: 0.45rem;
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
}

.calendar-weekdays span,
.calendar-spacer {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 2rem;
}

.calendar-day {
  min-height: 2.8rem;
  padding: 0.4rem;
  border-radius: 12px;
  background: rgba(243, 234, 223, 0.75);
  border: 1px solid rgba(113, 82, 52, 0.08);
}

.calendar-day:hover {
  background: #ead4bc;
}

.calendar-day-selected {
  background: var(--primary);
  color: #fff7ef;
}

.calendar-day-selected:hover {
  background: var(--primary-strong);
}

.calendar-day-today {
  box-shadow: inset 0 0 0 2px rgba(145, 74, 39, 0.35);
}

.calendar-day-past,
.calendar-day:disabled {
  opacity: 0.38;
  cursor: not-allowed;
  transform: none;
}

.selected-dates-card {
  display: grid;
  gap: 0.75rem;
  padding: 1rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.66);
  border: 1px solid rgba(113, 82, 52, 0.12);
}

.selected-dates-header {
  display: flex;
  gap: 0.75rem;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}

.selected-dates {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.selected-dates.empty-selection {
  color: var(--muted);
}

.selected-date-chip {
  gap: 0.5rem;
  padding: 0.7rem 0.9rem;
  border-radius: 999px;
  background: rgba(145, 74, 39, 0.12);
  color: var(--text);
}

.empty-state {
  padding: 1rem;
  border-radius: 18px;
  background: rgba(230, 214, 191, 0.4);
  color: var(--muted);
}

.hidden {
  display: none !important;
}

.date-input-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.date-input-row .date-input {
  flex: 1;
  min-width: 220px;
}

.summary-card,
.winner-card {
  padding: 1rem 1.1rem;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(255, 246, 231, 0.94), rgba(233, 212, 185, 0.72));
}

.winner-card {
  margin: 1rem 0;
}

.saved-polls,
.vote-list {
  display: grid;
  gap: 0.8rem;
}

.saved-poll,
.vote-item {
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  align-items: center;
  padding: 0.95rem 1rem;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(113, 82, 52, 0.12);
}

.saved-poll p,
.vote-item p {
  margin: 0.3rem 0 0;
  color: var(--muted);
}

.ranking-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.85rem;
}

.ranking-list-sorting .ranking-item:not(.dragging) {
  transition:
    transform 220ms cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 180ms ease,
    border-color 180ms ease,
    background 180ms ease;
}

.ranking-item {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: nowrap;
  gap: 1rem;
  padding: 1rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid rgba(113, 82, 52, 0.14);
  cursor: grab;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    border-color 180ms ease,
    background 180ms ease;
}

.ranking-monday {
  background: linear-gradient(135deg, rgba(255, 236, 214, 0.95), rgba(255, 251, 245, 0.88));
}

.ranking-tuesday {
  background: linear-gradient(135deg, rgba(255, 242, 204, 0.95), rgba(255, 251, 241, 0.88));
}

.ranking-wednesday {
  background: linear-gradient(135deg, rgba(232, 246, 214, 0.95), rgba(248, 252, 242, 0.88));
}

.ranking-thursday {
  background: linear-gradient(135deg, rgba(215, 242, 232, 0.95), rgba(241, 251, 247, 0.88));
}

.ranking-friday {
  background: linear-gradient(135deg, rgba(220, 238, 252, 0.95), rgba(243, 249, 255, 0.88));
}

.ranking-saturday {
  background: linear-gradient(135deg, rgba(233, 231, 252, 0.95), rgba(247, 245, 255, 0.88));
}

.ranking-sunday {
  background: linear-gradient(135deg, rgba(252, 228, 238, 0.95), rgba(255, 245, 249, 0.88));
}

.ranking-item.dragging {
  opacity: 0.45;
  transform: rotate(-1.5deg) scale(1.02);
  box-shadow: 0 22px 40px rgba(80, 53, 20, 0.2);
  border-color: rgba(145, 74, 39, 0.35);
  background: rgba(255, 248, 238, 0.96);
}

.ranking-item-unavailable {
  background: rgba(141, 47, 47, 0.08);
}

.ranking-item.drop-target-before::before,
.ranking-item.drop-target-after::after {
  content: "";
  position: absolute;
  left: 0.9rem;
  right: 0.9rem;
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(145, 74, 39, 0.25), rgba(145, 74, 39, 0.95));
  pointer-events: none;
}

.ranking-item.drop-target-before::before {
  top: -0.45rem;
}

.ranking-item.drop-target-after::after {
  bottom: -0.45rem;
}

.ranking-copy {
  flex: 1;
  min-width: 0;
}

.ranking-controls {
  display: flex;
  gap: 0.45rem;
  flex: 0 0 auto;
}

.ranking-move {
  min-width: 5.6rem;
  padding: 0.58rem 0.7rem;
  border: 1px solid rgba(113, 82, 52, 0.16);
  background: rgba(255, 255, 255, 0.66);
  font-weight: 700;
}

.ranking-affordance {
  flex: 0 0 auto;
  color: rgba(112, 88, 69, 0.7);
  letter-spacing: 0.08em;
  font-weight: 700;
  user-select: none;
}

.checkbox-field {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 600;
  white-space: nowrap;
}

.checkbox-field input {
  width: auto;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 0.9rem 0.75rem;
  border-bottom: 1px solid rgba(113, 82, 52, 0.12);
  text-align: left;
}

th {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.95rem;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.85rem;
}

.status-active {
  background: rgba(69, 97, 60, 0.14);
  color: var(--success);
}

.status-disqualified {
  background: rgba(141, 47, 47, 0.12);
  color: var(--danger);
}

.panel-subsection {
  margin-top: 1.4rem;
}

@media (max-width: 960px) {
  .page-grid-host {
    grid-template-columns: 1fr;
  }

  .saved-poll,
  .vote-item {
    flex-direction: column;
    align-items: flex-start;
  }

  .copy-row {
    flex-direction: column;
  }

  .calendar-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .ranking-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
  }

  .ranking-copy {
    min-width: 0;
  }

  .ranking-controls {
    grid-column: 1 / -1;
    width: 100%;
  }

  .ranking-move {
    flex: 1;
    min-width: 0;
  }

  .ranking-affordance {
    display: none;
  }

  .checkbox-field {
    justify-content: flex-end;
  }
}
