:root {
  --bg-1: #fff9f3;
  --bg-2: #ffeedf;
  --surface: #ffffff;
  --surface-soft: #fff6ee;
  --text: #2b2621;
  --muted: #6e645a;
  --line: #edd8c3;
  --accent: #e78d4f;
  --accent-strong: #d46f2f;
  --danger: #bf3f3f;
  --success: #2f8f57;
  --shadow: 0 14px 30px rgba(61, 37, 16, 0.12);
  --radius-lg: 20px;
  --radius-md: 14px;
  --wheel-item: 36px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Work Sans", "Segoe UI", sans-serif;
  color: var(--text);
  background: radial-gradient(circle at top right, #ffe8d2 0%, transparent 40%),
    linear-gradient(150deg, var(--bg-1) 0%, var(--bg-2) 100%);
}

h1,
h2,
h3 {
  font-family: "Fraunces", Georgia, serif;
  line-height: 1.2;
  margin-top: 0;
}

.app-shell {
  position: relative;
  min-height: 100vh;
  overflow-x: hidden;
}

.app-shell::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 220ms ease;
  z-index: 3;
}

body.waiting-mode .app-shell::before {
  opacity: 1;
  background: rgba(18, 12, 10, 0.08);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.app-shell > * {
  position: relative;
}

body.waiting-mode #waitingView {
  position: relative;
  z-index: 4;
}

.container {
  width: min(720px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2rem 0 6rem;
  animation: softRise 420ms ease-out;
}

.hero {
  margin-bottom: 1rem;
}

.eyebrow {
  margin: 0;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-strong);
  font-weight: 700;
}

.hero h1 {
  margin: 0.3rem 0;
  font-size: clamp(2rem, 5vw, 2.9rem);
}

.subtitle {
  margin: 0;
  color: var(--muted);
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 1.2rem;
  margin-top: 1.2rem;
  animation: crossFadeIn 280ms ease-in-out;
}

.hidden {
  display: none;
}

label {
  display: inline-block;
  margin: 0.6rem 0 0.35rem;
  font-weight: 600;
}

input[type="text"],
input[type="password"],
input[type="date"] {
  width: 100%;
  padding: 0.75rem 0.85rem;
  border: 1px solid #d9c6b2;
  border-radius: 10px;
  background: #fffdfa;
  font-size: 1rem;
  font-family: inherit;
  color: var(--text);
}

input:focus-visible,
button:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 45%, white);
  outline-offset: 2px;
}

.checkbox-block {
  margin: 0.8rem 0 0.5rem;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-weight: 500;
}

.checkbox-label input {
  width: 1.2rem;
  height: 1.2rem;
}

.checkmark-holder {
  margin: 0.8rem auto 0.6rem;
  width: 55px;
  height: 55px;
  border: 1px dashed #d6b89e;
  border-radius: 50%;
  display: grid;
  place-items: center;
}

.check-icon {
  width: 32px;
  height: 32px;
  stroke: var(--success);
  stroke-width: 2.5;
  fill: none;
  opacity: 0.2;
  transform: scale(0.9);
  transition: opacity 180ms ease, transform 180ms ease;
}

.check-icon.active {
  opacity: 1;
  transform: scale(1);
}

.waiting-loader {
  margin: 1rem 0 0.35rem;
  display: grid;
  place-items: center;
}

.cross-loader-inline {
  width: 56px;
  height: 56px;
}

.cross-loader-inline span {
  width: 48px;
  height: 7px;
}

.approved-badge {
  margin: 1rem auto 0.5rem;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 1px solid #cae9d5;
  background: #f2fbf6;
  display: grid;
  place-items: center;
}

.primary-btn,
.secondary-btn,
.text-btn {
  font-family: inherit;
  border-radius: 10px;
  border: 1px solid transparent;
  font-weight: 700;
  cursor: pointer;
}

.primary-btn {
  background: linear-gradient(135deg, var(--accent) 0%, #f3a66f 100%);
  color: #fff;
  padding: 0.72rem 1rem;
  width: 100%;
  margin-top: 0.9rem;
}

.primary-btn:disabled {
  cursor: not-allowed;
  opacity: 0.56;
}

.secondary-btn {
  background: var(--surface-soft);
  color: var(--text);
  border-color: var(--line);
  padding: 0.62rem 0.9rem;
}

.text-btn {
  background: transparent;
  color: var(--danger);
}

.status-text {
  margin-top: 0.75rem;
  min-height: 1.25rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.status-text.ok {
  color: var(--success);
}

.status-text.error,
.field-error {
  color: var(--danger);
}

#adminStatus {
  display: none !important;
}

.field-error {
  min-height: 1.2rem;
  margin: 0.45rem 0 0;
  font-size: 0.9rem;
}

.admin-trigger {
  position: fixed;
  bottom: 0.9rem;
  left: 50%;
  transform: translateX(-50%);
  border: 1px solid #d7c3af;
  background: #fff;
  color: #54483b;
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  font-size: 0.75rem;
  cursor: pointer;
  box-shadow: 0 7px 18px rgba(74, 44, 21, 0.12);
}

.admin-dialog {
  border: none;
  border-radius: 14px;
  padding: 0;
  max-width: min(420px, calc(100% - 2rem));
  width: 100%;
}

.admin-dialog::backdrop {
  background: rgba(50, 34, 20, 0.38);
  backdrop-filter: blur(2px);
}

.dialog-content {
  padding: 1.1rem;
}

.dialog-content h3 {
  margin-bottom: 0.4rem;
}

.dialog-content p {
  margin-top: 0;
  color: var(--muted);
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  margin-top: 0.5rem;
}

.month-year-dialog {
  border: none;
  border-radius: var(--radius-lg);
  padding: 0;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
  max-width: min(340px, calc(100% - 2rem));
  width: 100%;
  opacity: 1;
  transform: translateY(0) scale(1);
  transition: opacity 220ms ease, transform 220ms ease,
              overlay 220ms ease allow-discrete, display 220ms ease allow-discrete;
}

.month-year-dialog:not([open]) {
  opacity: 0;
  transform: translateY(10px) scale(0.98);
}

@starting-style {
  .month-year-dialog[open] {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
}

.month-year-dialog::backdrop {
  background: rgba(50, 34, 20, 0.38);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  opacity: 1;
  transition: opacity 220ms ease,
              overlay 220ms ease allow-discrete, display 220ms ease allow-discrete;
}

.month-year-dialog:not([open])::backdrop {
  opacity: 0;
}

@starting-style {
  .month-year-dialog[open]::backdrop {
    opacity: 0;
  }
}

.my-dialog-content {
  padding: 1.1rem;
  display: grid;
  gap: 0.85rem;
}

.my-dialog-title {
  margin: 0;
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.05rem;
  font-weight: 600;
  text-align: center;
}

.my-wheels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 0.75rem;
  align-items: end;
}

.my-wheel-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: center;
}

.my-wheel-row {
  grid-column: 1 / -1;
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 0.35rem;
}

.my-wheel {
  position: relative;
  z-index: 1;
  height: calc(var(--wheel-item) * 5);
  overflow-y: scroll;
  overflow-x: hidden;
  scroll-snap-type: y mandatory;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scrollbar-width: none;
  -ms-overflow-style: none;
  text-align: center;
  outline: none;
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 25%, #000 75%, transparent);
          mask-image: linear-gradient(to bottom, transparent, #000 25%, #000 75%, transparent);
}

.my-wheel::-webkit-scrollbar {
  display: none;
}

.my-wheel:focus-visible {
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 55%, white);
  border-radius: 10px;
}

.my-wheel-spacer {
  height: calc(var(--wheel-item) * 2);
}

.my-wheel-item {
  height: var(--wheel-item);
  line-height: var(--wheel-item);
  scroll-snap-align: center;
  scroll-snap-stop: always;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--muted);
  opacity: 0.65;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
  transition: color 120ms ease, font-size 120ms ease, opacity 120ms ease;
}

.my-wheel-item.is-selected {
  color: var(--text);
  font-weight: 700;
  font-size: 1.18rem;
  opacity: 1;
}

.my-wheel-input {
  display: none;
  position: absolute;
  z-index: 2;
  top: 50%;
  transform: translateY(-50%);
  height: var(--wheel-item);
  padding: 0 0.3rem;
  box-sizing: border-box;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  text-align: center;
  outline: none;
}

.my-wheel-input.is-editing {
  display: block;
}

.my-wheel-input:focus {
  border-color: var(--accent-strong);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 30%, white);
}

.my-wheel-band {
  position: absolute;
  z-index: 0;
  left: 0;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  height: var(--wheel-item);
  pointer-events: none;
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 12%, #fff);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.my-dialog-actions {
  display: flex;
  justify-content: flex-end;
}

.my-done-btn {
  width: auto;
  margin-top: 0;
  min-width: 104px;
  font-weight: 600;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
}

.admin-header-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  position: relative;
}

.admin-action-btn {
  width: auto;
  margin: 0;
  padding: 0.45rem 0.75rem;
  font-size: 0.9rem;
}

.icon-btn {
  width: 2.3rem;
  height: 2.3rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.icon-btn svg {
  width: 1.15rem;
  height: 1.15rem;
}

.settings-wrap {
  position: relative;
}

.settings-menu {
  position: absolute;
  top: calc(100% + 0.4rem);
  right: 0;
  z-index: 6;
  min-width: 176px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fffefa;
  box-shadow: 0 10px 24px rgba(51, 33, 17, 0.16);
  padding: 0.45rem;
  display: grid;
  gap: 0.35rem;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 200ms ease, transform 220ms ease;
}

.settings-menu.settings-open {
  opacity: 1;
  transform: translateY(0);
}

.settings-menu.hidden {
  display: none;
}

.settings-btn {
  width: 100%;
  text-align: left;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 0.5rem 0.6rem;
}

.admin-section-title {
  margin: 1rem 0 0.4rem;
  font-size: 1.04rem;
}

.admin-nav {
  margin-top: 0.9rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem;
}

.panel-tab {
  border: 1px solid var(--line);
  background: #fffaf5;
  color: var(--text);
  border-radius: 10px;
  padding: 0.55rem 0.7rem;
  font-weight: 700;
  cursor: pointer;
}

.panel-tab.active {
  background: linear-gradient(135deg, #f3a66f 0%, #e78d4f 100%);
  border-color: #e28a4b;
  color: #fff;
}

.admin-subpanel {
  margin-top: 0.75rem;
}

#adminAttendeesPanel {
  overflow: hidden;
  opacity: 0;
  transform: translateY(-8px);
  max-height: 0;
  margin-top: 0;
  transition: max-height 260ms ease, opacity 220ms ease, transform 260ms ease, margin-top 260ms ease;
}

#adminAttendeesPanel.attendees-open {
  opacity: 1;
  transform: translateY(0);
  max-height: 1200px;
  margin-top: 0.75rem;
}

.admin-top-approvals {
  margin-top: 0.45rem;
  margin-left: auto;
  width: min(360px, 100%);
}

.admin-subpanel .admin-section-title {
  margin-top: 0;
}

.admin-list-head {
  margin-top: 0.25rem;
  display: grid;
  grid-template-columns: 1fr;
  align-items: center;
  gap: 0.35rem 0.6rem;
}

.admin-list-head .admin-section-title {
  margin: 0;
}

.attendees-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.all-checkins-list .approval-item {
  padding: 0.62rem 0.78rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.all-checkins-details {
  min-width: 0;
}

.all-checkins-name {
  margin: 0.1rem 0;
  font-weight: 700;
}

.all-checkins-time {
  margin: 0 0 0.08rem;
  color: var(--muted);
  font-size: 0.86rem;
}

.delete-attendee-btn {
  width: 2rem;
  height: 2rem;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #f0c8c8;
  border-radius: 8px;
  background: #fff5f5;
  color: var(--danger);
  cursor: pointer;
}

.delete-attendee-btn svg {
  width: 1rem;
  height: 1rem;
}

.checkbox-label.compact {
  margin: 0;
  font-size: 0.92rem;
}

.checkbox-label.compact input {
  width: 1rem;
  height: 1rem;
}

.approval-list {
  margin: 1rem 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.65rem;
}

.approval-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fffdfa;
}

.name-toggle {
  width: 100%;
  border: none;
  background: transparent;
  text-align: left;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  padding: 0.72rem 0.78rem;
  cursor: pointer;
}

.approval-actions {
  display: none;
  padding: 0 0.78rem 0.78rem;
  gap: 0.5rem;
}

.approval-actions.open {
  display: flex;
}

.approval-actions button {
  flex: 1;
  padding: 0.55rem 0.7rem;
  border-radius: 9px;
  border: 1px solid var(--line);
  font-weight: 600;
  cursor: pointer;
}

.approve-btn {
  background: #edf9f1;
  color: #1f6f42;
}

.deny-btn {
  background: #fff1f1;
  color: #982f2f;
}

.admin-footer-controls {
  display: grid;
  gap: 0.5rem;
  border-top: 1px solid var(--line);
  padding-top: 0.9rem;
}

.calendar-field-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
  align-items: center;
}

.calendar-field-btn {
  width: 100%;
  border: 1px solid #d9c6b2;
  border-radius: 10px;
  background: #fffdfa;
  color: var(--text);
  padding: 0.75rem 2.2rem 0.75rem 0.85rem;
  text-align: left;
  font-size: 1rem;
  font-family: inherit;
  cursor: pointer;
  position: relative;
}

.calendar-field-btn::after {
  content: "";
  position: absolute;
  right: 0.65rem;
  top: 50%;
  width: 1rem;
  height: 1rem;
  transform: translateY(-50%);
  background-repeat: no-repeat;
  background-size: contain;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23706050' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='17' rx='2' ry='2'/%3E%3Cline x1='3' y1='10' x2='21' y2='10'/%3E%3Cline x1='8' y1='2.8' x2='8' y2='6'/%3E%3Cline x1='16' y1='2.8' x2='16' y2='6'/%3E%3C/svg%3E");
}

.calendar-picker {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fffdfa;
  padding: 0.65rem;
  display: grid;
  gap: 0.45rem;
  overflow: hidden;
  opacity: 0;
  transform: translateY(-8px);
  max-height: 0;
  margin-top: 0;
  transition: max-height 240ms ease, opacity 200ms ease, transform 240ms ease, margin-top 240ms ease;
}

.calendar-picker.calendar-open {
  opacity: 1;
  transform: translateY(0);
  max-height: 760px;
  margin-top: 0.35rem;
}

.calendar-actions {
  display: flex;
  justify-content: flex-end;
}

.calendar-picker.hidden {
  display: none;
}

.calendar-topbar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.5rem;
}

.calendar-nav-btn {
  margin: 0;
  padding: 0.35rem 0.5rem;
  min-width: 2rem;
}

.calendar-nav-btn svg {
  width: 1rem;
  height: 1rem;
  display: block;
}

.calendar-month-label {
  margin: 0;
  text-align: center;
  font-family: "Fraunces", Georgia, serif;
  font-size: 1rem;
  font-weight: 600;
}

.calendar-month-label-btn {
  border: 1px solid #d9c6b2;
  border-radius: 8px;
  background: #fff7ef;
  color: var(--text);
  cursor: pointer;
  padding: 0.25rem 0.45rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.calendar-month-label-btn:hover,
.calendar-month-label-btn:focus-visible {
  border-color: #d9c6b2;
  background: #fff7ef;
  outline: none;
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.3rem;
  color: var(--muted);
  font-size: 0.74rem;
  text-transform: uppercase;
}

.calendar-weekdays span {
  text-align: center;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.3rem;
}

.calendar-day {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  min-height: 1.9rem;
  font-size: 0.84rem;
  cursor: pointer;
}

.calendar-day.other-month {
  color: #b4a291;
  background: #fff7ef;
}

.calendar-day.today {
  border-color: #e4aa7d;
}

.calendar-day.selected {
  background: linear-gradient(135deg, #f3a66f 0%, #e78d4f 100%);
  border-color: #e28a4b;
  color: #fff;
}

.muted {
  color: var(--muted);
}

.loader-overlay {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, rgba(255, 244, 231, 0.95), rgba(255, 232, 208, 0.95));
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 260ms ease, visibility 260ms ease;
}

.loader-overlay.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.network-error-overlay {
  position: fixed;
  inset: 0;
  z-index: 12;
  display: none;
  place-items: center;
  background: #c7c7c7;
}

.network-error-overlay.active {
  display: grid;
}

.network-error-content {
  display: grid;
  place-items: center;
  gap: 0.9rem;
  text-align: center;
  padding: 1.5rem;
}

.network-plug-icon {
  width: 108px;
  height: 108px;
  color: #111;
  fill: currentColor;
}

.network-plug-icon .wifi-symbol {
  fill: currentColor;
}

.network-error-text {
  margin: 0;
  font-family: "Work Sans", "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  font-weight: 700;
  text-transform: uppercase;
  color: #111;
  font-size: clamp(1.35rem, 3.8vw, 2rem);
  letter-spacing: 0.06em;
}

.cross-loader {
  position: relative;
  width: 92px;
  height: 92px;
  animation: cleanPulse 1.8s ease-in-out infinite;
}

.cross-loader span {
  position: absolute;
  top: 50%;
  left: 50%;
  border-radius: 999px;
  transform-origin: center;
  background: linear-gradient(90deg, #eb9b5a, #d57333);
}

.cross-loader span:first-child {
  width: 12px;
  height: 96px;
  transform: translate(-50%, -48%);
}

.cross-loader span:last-child {
  width: 74px;
  height: 12px;
  transform: translate(-50%, -155%);
}

.loader-overlay.active .cross-loader span {
  animation: barGlow 1.8s ease-in-out infinite;
}

.loader-overlay.active .cross-loader span:last-child {
  animation-delay: 140ms;
}

.loader-text {
  margin-top: 0.8rem;
  font-weight: 600;
  color: #8a5a34;
}

@keyframes cleanPulse {
  0%,
  100% {
    transform: scale(0.96);
    opacity: 0.78;
  }
  50% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes barGlow {
  0%,
  100% {
    filter: saturate(0.95);
    opacity: 0.78;
    box-shadow: 0 8px 20px rgba(213, 121, 57, 0.2);
  }
  50% {
    filter: saturate(1.05);
    opacity: 1;
    box-shadow: 0 10px 24px rgba(213, 121, 57, 0.34);
  }
}

@keyframes crossFadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes softRise {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

@media (max-width: 560px) {
  .container {
    width: calc(100% - 1rem);
    padding-top: 1.2rem;
  }

  .card {
    padding: 1rem;
  }

  .admin-header {
    align-items: flex-start;
  }

  .admin-header-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .admin-nav {
    grid-template-columns: 1fr;
  }

  .admin-list-head {
    grid-template-columns: 1fr;
  }

  .admin-top-approvals {
    width: 100%;
    margin-left: 0;
  }

  .attendees-controls {
    align-items: flex-start;
  }

  .calendar-field-row {
    grid-template-columns: 1fr;
  }
}
