:root {
  --bg: #f8f4ec;
  --surface: #ffffff;
  --text: #111633;
  --muted: #6f7487;
  --primary: #6254f3;
  --primary-dark: #4d3fe0;
  --primary-soft: #eeeaff;
  --accent: #ff9f43;
  --accent-soft: #fff1df;
  --success: #23865f;
  --success-soft: #e7f7ef;
  --danger: #df405b;
  --danger-soft: #fff0f3;
  --line: rgba(17, 22, 51, 0.10);
  --shadow: 0 18px 45px rgba(30, 25, 60, 0.10);
  --radius-lg: 28px;
  --radius-md: 20px;
  --radius-sm: 14px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    linear-gradient(135deg, rgba(238, 234, 255, 0.72) 0 14rem, transparent 14rem),
    linear-gradient(315deg, rgba(255, 241, 223, 0.90) 0 16rem, transparent 16rem),
    var(--bg);
}

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

a {
  color: inherit;
  text-decoration: none;
}

h1,
h2,
h3,
p {
  margin: 0;
}

.app-shell {
  width: min(100% - 24px, 1060px);
  margin: 0 auto;
  padding: 22px 0 40px;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 0 auto 28px;
  max-width: 900px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  font-size: 1.08rem;
  font-weight: 850;
}

.brand strong {
  color: var(--primary);
}

.brand-mark,
.login-emblem {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border-radius: 14px;
  color: var(--primary);
  background: var(--primary-soft);
  border: 1px solid rgba(98, 84, 243, 0.22);
  font-weight: 950;
  box-shadow: 0 10px 22px rgba(98, 84, 243, 0.16);
}

.public-view,
.admin-view {
  max-width: 900px;
  margin: 0 auto;
}

.hero-section {
  padding: 10px 8px 22px;
  text-align: center;
}

.hero-section h1 {
  max-width: 520px;
  margin: 0 auto;
  font-size: 2.08rem;
  line-height: 1.16;
  font-weight: 950;
}

.hero-section span {
  position: relative;
  color: var(--primary);
  white-space: nowrap;
}

.hero-section span::after {
  content: "";
  position: absolute;
  left: 2px;
  right: 2px;
  bottom: -7px;
  height: 4px;
  border-radius: 99px;
  background: var(--accent);
}

.week-switcher {
  display: grid;
  grid-template-columns: 48px 1fr 48px;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  margin: 0 auto 14px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 8px 22px rgba(30, 25, 60, 0.06);
}

.week-switcher strong {
  text-align: center;
  font-size: 1.02rem;
}

.circle-btn {
  display: grid;
  place-items: center;
  min-width: 44px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 1.7rem;
  line-height: 1;
  box-shadow: 0 8px 18px rgba(30, 25, 60, 0.07);
}

.day-chips {
  display: flex;
  gap: 8px;
  margin: 0 0 28px;
  overflow-x: auto;
  padding: 2px 1px 6px;
  scrollbar-width: none;
}

.day-chips::-webkit-scrollbar {
  display: none;
}

.chip,
.outline-btn,
.primary-btn,
.pill-btn,
.text-action,
.mini-btn,
.small-btn {
  min-height: 44px;
  border-radius: 999px;
  font-weight: 800;
}

.chip {
  flex: 0 0 auto;
  min-width: 58px;
  padding: 0 16px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 8px 18px rgba(30, 25, 60, 0.06);
}

.chip.selected,
.primary-btn {
  border-color: transparent;
  background: linear-gradient(180deg, #7267ff, var(--primary));
  color: #fff;
  box-shadow: 0 12px 24px rgba(98, 84, 243, 0.23);
}

.primary-btn,
.outline-btn {
  border: 1px solid transparent;
  padding: 0 18px;
}

.primary-btn:hover {
  background: var(--primary-dark);
}

.outline-btn {
  background: rgba(255, 255, 255, 0.82);
  color: var(--primary);
  border-color: rgba(98, 84, 243, 0.35);
}

.small-btn {
  min-height: 40px;
  padding: 0 14px;
  white-space: nowrap;
}

.mini-btn {
  min-height: 40px;
  padding: 0 13px;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
}

.section-title h2 {
  font-size: 1rem;
}

.slots-list {
  display: grid;
  gap: 14px;
}

.slot-card,
.empty-card,
.admin-slot-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: 0 10px 28px rgba(30, 25, 60, 0.08);
}

.public-slot {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr) 54px;
  gap: 13px;
  align-items: center;
  min-height: 122px;
  padding: 14px;
}

.slot-icon {
  display: grid;
  place-items: center;
  width: 68px;
  height: 68px;
  border-radius: 18px;
  background: var(--primary-soft);
  color: var(--primary);
}

.slot-icon.warm {
  background: var(--accent-soft);
  color: var(--accent);
}

.calendar-mini {
  position: relative;
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 2px solid currentColor;
  border-radius: 7px;
}

.calendar-mini::before {
  content: "";
  position: absolute;
  left: -2px;
  right: -2px;
  top: 6px;
  height: 2px;
  background: currentColor;
}

.calendar-mini::after {
  content: "";
  position: absolute;
  left: 5px;
  top: -5px;
  width: 10px;
  height: 7px;
  border-left: 2px solid currentColor;
  border-right: 2px solid currentColor;
}

.sun-mini {
  position: relative;
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 2px solid currentColor;
  border-radius: 999px;
}

.sun-mini::before,
.sun-mini::after {
  content: "";
  position: absolute;
  inset: -9px;
  border-top: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
}

.sun-mini::after {
  transform: rotate(90deg);
}

.slot-copy {
  min-width: 0;
}

.slot-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.slot-line h3 {
  min-width: 0;
  font-size: 1rem;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.slot-copy p,
.admin-slot-body p {
  margin-top: 7px;
  color: var(--muted);
}

.activity-state {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 9px;
}

.activity-state small {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 750;
}

.slot-copy strong,
.admin-slot-body strong {
  display: block;
  margin-top: 7px;
  color: var(--primary);
  font-size: 0.9rem;
}

.warning-text {
  color: #f06f15 !important;
}

.soft-badge {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.78rem;
  font-weight: 850;
  white-space: nowrap;
}

.soft-badge.warning,
.soft-badge.full {
  color: #c95c10;
  background: var(--accent-soft);
}

.soft-badge.open {
  color: var(--success);
  background: var(--success-soft);
}

.soft-badge.confirmed {
  color: var(--success);
  background: var(--success-soft);
}

.soft-badge.pending {
  color: #9a6215;
  background: var(--accent-soft);
}

.soft-badge.closed,
.soft-badge.hidden-slot {
  color: var(--muted);
  background: rgba(111, 116, 135, 0.12);
}

.badge-stack {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 6px;
}

.round-action {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(180deg, #766cff, var(--primary));
  color: #fff;
  font-size: 1.55rem;
  box-shadow: 0 10px 22px rgba(98, 84, 243, 0.28);
}

.text-action {
  grid-column: 3;
  min-height: auto;
  border: 0;
  background: transparent;
  color: var(--primary);
  padding: 0;
  font-size: 0.82rem;
}

.empty-card {
  display: grid;
  gap: 14px;
  justify-items: start;
  padding: 20px;
}

.empty-card h3 {
  font-size: 1.05rem;
}

.admin-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.admin-top h1 {
  font-size: 1.9rem;
  line-height: 1.15;
}

.quick-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 24px;
}

.admin-days {
  display: grid;
  gap: 22px;
}

.admin-day {
  display: grid;
  gap: 12px;
  padding-top: 2px;
}

.admin-day + .admin-day {
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.admin-day-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.admin-day-head h2 {
  font-size: 1rem;
}

.admin-day-head p,
.muted-line {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.88rem;
}

.admin-slot-list {
  display: grid;
  gap: 12px;
}

.admin-slot-card {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 13px;
  padding: 12px;
}

.admin-slot-card .slot-icon {
  width: 58px;
  height: 58px;
  border-radius: 16px;
}

.admin-slot-body {
  min-width: 0;
}

.slot-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.pill-btn {
  min-height: 36px;
  border: 1px solid rgba(98, 84, 243, 0.22);
  background: #fff;
  color: var(--primary);
  padding: 0 12px;
  font-size: 0.82rem;
}

.warm-pill {
  color: #d46f14;
  border-color: rgba(255, 159, 67, 0.34);
  background: var(--accent-soft);
}

.danger-pill {
  color: var(--danger);
  border-color: rgba(223, 64, 91, 0.22);
  background: var(--danger-soft);
}

.registrations-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.registration-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.registration-item strong,
.registration-item small {
  display: block;
}

.registration-item small,
.registration-item p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.82rem;
  overflow-wrap: anywhere;
}

.sheet-dialog {
  position: fixed;
  inset: auto 0 0 0;
  width: min(100% - 20px, 520px);
  max-height: calc(100dvh - 18px);
  margin: 0 auto;
  padding: 0;
  border: 0;
  background: transparent;
  overflow: visible;
}

.sheet-dialog::backdrop {
  background: rgba(17, 22, 51, 0.58);
  backdrop-filter: blur(5px);
}

.sheet-card {
  position: relative;
  display: grid;
  gap: 15px;
  max-height: calc(100dvh - 18px);
  margin: 0;
  overflow: auto;
  padding: 28px 20px 20px;
  border-radius: 24px 24px 0 0;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.sheet-card h2 {
  text-align: center;
  font-size: 1.45rem;
}

.dialog-subtitle {
  color: var(--primary);
  text-align: center;
  font-weight: 800;
}

.drag-handle {
  width: 46px;
  height: 5px;
  margin: -10px auto 4px;
  border-radius: 99px;
  background: rgba(111, 116, 135, 0.28);
}

.icon-close {
  position: absolute;
  top: 14px;
  right: 14px;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--text);
  font-size: 1.3rem;
  line-height: 1;
}

label {
  display: grid;
  gap: 8px;
  color: #303650;
  font-size: 0.87rem;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  min-height: 46px;
  border: 1px solid rgba(17, 22, 51, 0.14);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text);
  outline: none;
  padding: 12px 13px;
}

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

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(98, 84, 243, 0.58);
  box-shadow: 0 0 0 4px rgba(98, 84, 243, 0.12);
}

.checkbox-row {
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: 10px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.42;
}

.checkbox-row input[type="checkbox"] {
  width: 20px;
  min-height: 20px;
  height: 20px;
  margin-top: 1px;
  accent-color: var(--primary);
  border-radius: 6px;
  box-shadow: none;
}

.consent-row.is-required span::after {
  content: " *";
  color: var(--danger);
  font-weight: 900;
}

.dialog-actions {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: 10px;
  margin-top: 6px;
}

.login-card {
  padding-top: 44px;
}

.login-emblem {
  width: 58px;
  height: 58px;
  margin: 0 auto 2px;
  border-radius: 18px;
  font-size: 1.35rem;
}

.two-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.switch-row {
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 14px;
}

.switch-row small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-weight: 650;
}

.switch-row input {
  position: relative;
  width: 54px;
  min-height: 32px;
  height: 32px;
  appearance: none;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(111, 116, 135, 0.25);
  transition: background 0.18s ease;
}

.switch-row input::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(17, 22, 51, 0.18);
  transition: transform 0.18s ease;
}

.switch-row input:checked {
  background: var(--primary);
}

.switch-row input:checked::after {
  transform: translateX(22px);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 10;
  display: flex;
  align-items: center;
  min-height: 54px;
  max-width: min(420px, calc(100% - 28px));
  transform: translateX(-50%);
  padding: 12px 18px;
  border-radius: 14px;
  background: var(--success-soft);
  color: #11633f;
  border: 1px solid rgba(35, 134, 95, 0.18);
  box-shadow: var(--shadow);
  font-weight: 850;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.danger {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: rgba(223, 64, 91, 0.18);
}

.toast.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 8px);
}

.hidden {
  display: none !important;
}

@media (max-width: 370px) {
  .public-slot {
    grid-template-columns: 56px minmax(0, 1fr) 48px;
    gap: 10px;
    padding: 12px;
  }

  .slot-icon {
    width: 56px;
    height: 56px;
  }

  .hero-section h1 {
    font-size: 1.86rem;
  }

  .quick-actions,
  .dialog-actions,
  .two-fields {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 720px) {
  .app-shell {
    padding-top: 34px;
  }

  .public-view {
    max-width: 820px;
  }

  .hero-section {
    padding-top: 30px;
  }

  .hero-section h1 {
    font-size: 2.75rem;
  }

  .slots-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sheet-dialog {
    inset: 0;
    width: min(520px, calc(100% - 36px));
    margin: auto;
  }

  .sheet-card {
    border-radius: var(--radius-lg);
    padding: 30px;
  }
}

@media (min-width: 920px) {
  .admin-slot-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
