:root {
  --bg: #f5f5f7;
  --card: #ffffff;
  --surface-soft: #fbfbfd;
  --stroke: #d2d2d7;
  --stroke-soft: #e5e5ea;
  --border: #e5e5ea;
  --text: #1d1d1f;
  --text-soft: #6e6e73;
  --primary: #0071e3;
  --primary-hover: #0062c3;
  --primary-soft: #eaf3ff;
  --primary-rgb: 0, 113, 227;
  --teal: #0a84ff;
  --teal-soft: #eef6ff;
  --orange: #8e8e93;
  --orange-soft: #f2f2f7;
  --red-soft: #fff1f0;
  --green-soft: #ecf9f1;
  --danger: #ff3b30;
  --success: #34c759;
  --shadow: 0 10px 28px rgba(0, 0, 0, 0.07);
  --radius-xl: 24px;
  --radius-lg: 20px;
  --radius-md: 16px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

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

button {
  border: 0;
  background: transparent;
  cursor: pointer;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--stroke);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  padding: 0.9rem 1rem;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(var(--primary-rgb), 0.45);
  box-shadow: 0 0 0 4px rgba(var(--primary-rgb), 0.14);
}

.page-shell {
  max-width: 1600px;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 2rem;
}

.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(360px, 1fr) minmax(420px, 560px);
  align-items: center;
  gap: 1.8rem;
  margin-bottom: 1.5rem;
  padding: 1.5rem;
  border: 1px solid var(--stroke);
  border-radius: var(--radius-xl);
  background: var(--card);
  box-shadow: var(--shadow);
}

.hero-copy {
  padding-top: 0;
}

.hero-copy h2 {
  margin: 0;
  color: var(--text);
  font-size: clamp(1.9rem, 2.3vw, 2.65rem);
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.hero-copy p {
  max-width: 650px;
  margin: 0.95rem 0 0;
  color: var(--text-soft);
  font-size: 1.08rem;
  line-height: 1.6;
}

.wave {
  font-size: 0.9em;
}

.hero-illustration {
  display: grid;
  place-items: center;
  border-radius: 22px;
  overflow: hidden;
  border: 1px solid var(--stroke-soft);
  background: #f8f9fb;
}

.hero-illustration img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  border-radius: 22px;
}

.shape-blob {
  position: absolute;
  top: 8px;
  right: 30px;
  width: 430px;
  height: 180px;
  border-radius: 80px;
  background: #f6f0ef;
}

.shape-calendar {
  position: absolute;
  top: 14px;
  left: 130px;
  width: 70px;
  height: 64px;
  border-radius: 16px;
  background: #fff9f7;
  border: 1px solid #f0e7e7;
}

.shape-calendar::before,
.shape-calendar::after {
  content: "";
  position: absolute;
  top: -6px;
  width: 5px;
  height: 15px;
  border-radius: 99px;
  background: var(--primary);
}

.shape-calendar::before {
  left: 18px;
}

.shape-calendar::after {
  right: 18px;
}

.shape-toys {
  position: absolute;
  left: 108px;
  bottom: 34px;
  width: 54px;
  height: 90px;
}

.shape-toys::before,
.shape-toys::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  margin: auto;
  border-radius: 999px;
}

.shape-toys::before {
  bottom: 0;
  width: 44px;
  height: 14px;
  background: #ffb347;
  box-shadow: 0 -18px 0 0 #ff7c59, 0 -36px 0 0 #7cd38d, 0 -54px 0 0 #8b80f0;
}

.shape-plant-left,
.shape-plant-right {
  position: absolute;
  width: 56px;
  height: 120px;
}

.shape-plant-left {
  left: 36px;
  top: 18px;
}

.shape-plant-right {
  right: 18px;
  top: 62px;
}

.shape-plant-left::before,
.shape-plant-right::before,
.shape-plant-left::after,
.shape-plant-right::after {
  content: "";
  position: absolute;
  width: 22px;
  height: 46px;
  border-radius: 22px 22px 0 22px;
  background: #89d8a4;
}

.shape-plant-left::before {
  left: 10px;
  top: 0;
  transform: rotate(-20deg);
}

.shape-plant-left::after {
  left: 28px;
  top: 26px;
  transform: rotate(24deg);
}

.shape-plant-right::before {
  left: 8px;
  top: 6px;
  transform: rotate(-15deg);
  background: #97deea;
}

.shape-plant-right::after {
  left: 30px;
  top: 34px;
  transform: rotate(16deg);
  background: #9de2f4;
}

.avatar {
  position: absolute;
}

.avatar .face {
  position: absolute;
  border-radius: 50%;
  background: #f5b28c;
}

.avatar .hair {
  position: absolute;
  border-radius: 999px;
  background: #a95f49;
}

.avatar .body {
  position: absolute;
  border-radius: 34px 34px 10px 10px;
}

.avatar-adult {
  top: 18px;
  left: 250px;
  width: 160px;
  height: 180px;
}

.avatar-adult .hair {
  left: 22px;
  top: 0;
  width: 100px;
  height: 86px;
}

.avatar-adult .face {
  left: 42px;
  top: 16px;
  width: 64px;
  height: 76px;
}

.avatar-adult .body {
  left: 20px;
  top: 78px;
  width: 118px;
  height: 88px;
  background: #ffc355;
}

.avatar-adult .tablet {
  position: absolute;
  left: 56px;
  top: 98px;
  width: 48px;
  height: 64px;
  border-radius: 8px;
  background: var(--primary);
}

.avatar-child {
  width: 106px;
  height: 128px;
}

.avatar-child .hair {
  top: 6px;
  left: 20px;
  width: 56px;
  height: 42px;
}

.avatar-child .face {
  top: 18px;
  left: 26px;
  width: 42px;
  height: 50px;
}

.avatar-child .body {
  top: 64px;
  left: 8px;
  width: 84px;
  height: 54px;
}

.child-left {
  top: 72px;
  left: 190px;
}

.child-left .body {
  background: var(--teal);
}

.child-right {
  top: 80px;
  left: 390px;
}

.child-right .hair {
  background: #bd6d53;
}

.child-right .body {
  background: #ff9c6e;
}

.stepper-card,
.panel-card,
.cta-card,
.summary-bar {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(10px);
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow);
}

.stepper-card {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr auto 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  padding: 1.2rem 1.35rem;
  border-radius: var(--radius-xl);
  margin-bottom: 1rem;
}

.step-item {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.step-number,
.mini-badge {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  color: #fff;
  font-size: 2rem;
  font-weight: 800;
  flex: 0 0 auto;
}

.mini-badge {
  width: 34px;
  height: 34px;
  font-size: 1rem;
}

.violet {
  background: var(--primary);
}

.teal {
  background: var(--teal);
}

.orange {
  background: var(--orange);
}

.step-item h3,
.panel-title-row h3 {
  margin: 0;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}

.step-item p,
.field-label,
.panel-title-row,
.events-card h4,
.summary-item span,
.info-tip,
.cta-copy {
  color: var(--text-soft);
}

.step-item p {
  margin: 0.25rem 0 0;
  font-size: 1rem;
}

.step-arrow {
  font-size: 2rem;
  color: var(--text-soft);
  line-height: 1;
}

.step-number.violet,
.step-number.teal,
.mini-badge.violet,
.mini-badge.teal {
  background: var(--orange);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-areas:
    "panel-1 panel-2"
    "panel-1 panel-3"
    "panel-1 panel-4"
    "panel-5 panel-5";
  gap: 1rem;
  align-items: stretch;
}

.dashboard-grid > .panel-card:first-of-type {
  grid-area: panel-1;
  order: 1;
}

#closures-section {
  grid-area: panel-2;
  order: 2;
}

#unavailability-section {
  grid-area: panel-3;
  order: 3;
}

#conflicts-section {
  grid-area: panel-4;
  order: 4;
}

.dashboard-grid > .cta-card {
  grid-area: panel-5;
  order: 5;
}

.panel-card,
.cta-card {
  border-radius: var(--radius-xl);
  padding: 1rem;
}

.panel-card {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.panel-title-row {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.panel-head-between {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.inline-select {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 170px;
  color: var(--text-soft);
  font-size: 0.92rem;
}

.compact-select {
  max-width: 170px;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.field-help-text {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.84rem;
}

.checkbox-row {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
}

.checkbox-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  padding: 0;
  accent-color: var(--primary);
}

.slim-gap {
  gap: 0.4rem;
}

.field-group label,
.field-label,
.events-card h4,
.participants-list h4 {
  color: var(--text);
  font-weight: 700;
  font-size: 0.98rem;
}

.tabs-row {
  display: flex;
  gap: 0.5rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--stroke-soft);
}

.tab-button {
  color: var(--text-soft);
  padding: 0.55rem 1rem;
  border-radius: 12px 12px 0 0;
  font-weight: 700;
}

.tab-active {
  color: var(--primary);
  box-shadow: inset 0 -3px 0 var(--primary);
}

.role-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

.role-grid-compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.role-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  min-height: 108px;
  padding: 0.9rem;
  text-align: center;
  color: var(--text-soft);
  background: #fff;
  border: 1px solid var(--stroke);
  border-radius: 16px;
}

.role-card-active {
  border-color: rgba(var(--primary-rgb), 0.35);
  box-shadow: inset 0 0 0 1px rgba(var(--primary-rgb), 0.22);
  color: var(--primary);
}

.role-card-orange {
  color: var(--orange);
}

.role-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.55rem;
  line-height: 1;
}

.role-icon-pair {
  gap: 0;
}

.role-icon-pair .bi {
  font-size: 1.55rem;
  margin-inline: -0.2rem;
}

.role-icon-pair .bi:nth-child(2) {
  position: relative;
  z-index: 2;
}

.role-icon-pair .mirrored {
  display: inline-block;
  transform: scaleX(-1);
}

.field-group-suggestions {
  position: relative;
}

.suggestions-popover {
  position: absolute;
  left: 0;
  top: calc(100% - 0.1rem);
  width: min(100%, 360px);
  max-height: 220px;
  overflow: auto;
  border: 1px solid var(--stroke-soft);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 12px 24px rgba(23, 30, 70, 0.14);
  z-index: 20;
}

.suggestion-item {
  width: 100%;
  padding: 0.52rem 0.72rem;
  text-align: left;
  color: var(--text);
  font-weight: 600;
  font-size: 0.92rem;
}

.suggestion-item:hover,
.suggestion-item:focus-visible {
  background: var(--primary-soft);
}

.primary-button,
.secondary-button,
.outline-button,
.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  min-height: 54px;
  padding: 0.9rem 1.1rem;
  border-radius: 14px;
  text-decoration: none;
  font-weight: 800;
}

.primary-button {
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  box-shadow: 0 14px 24px rgba(var(--primary-rgb), 0.22);
}

.primary-button:hover {
  transform: translateY(-1px);
}

.import-file-button {
  min-height: 42px;
  padding: 0.6rem 0.9rem;
  border-radius: 11px;
  font-size: 0.9rem;
  font-weight: 700;
}

.outline-button {
  color: var(--primary);
  background: #fff;
  border: 1px solid rgba(var(--primary-rgb), 0.2);
}

.ghost-button {
  width: 100%;
  color: var(--primary);
  background: var(--primary-soft);
}

.secondary-button {
  color: var(--primary);
  background: var(--surface-soft);
  border: 1px solid rgba(var(--primary-rgb), 0.2);
  white-space: nowrap;
}

.participants-list {
  padding-top: 0.2rem;
}

.bulk-import-card {
  display: grid;
  gap: 0.55rem;
  padding: 0.75rem;
  border: 1px solid var(--stroke-soft);
  border-radius: 14px;
  background: var(--surface-soft);
}

.bulk-import-head {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
}

.bulk-import-head i {
  color: var(--primary);
  font-size: 1.25rem;
  line-height: 1;
}

.bulk-import-head strong {
  display: block;
  color: var(--text);
  font-size: 0.92rem;
}

.bulk-import-head span {
  display: block;
  margin-top: 0.12rem;
  color: var(--text-soft);
  font-size: 0.84rem;
}

.participants-dropzone {
  display: grid;
  justify-items: center;
  gap: 0.35rem;
  padding: 0.8rem 0.7rem;
  border: 1.5px dashed var(--stroke);
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.14s ease, background-color 0.14s ease,
    box-shadow 0.14s ease;
}

.participants-dropzone i {
  color: var(--primary);
  font-size: 1.4rem;
}

.participants-dropzone p {
  margin: 0;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 700;
  text-align: center;
}

.participants-dropzone span {
  color: var(--text-soft);
  font-size: 0.84rem;
  font-weight: 600;
}

.participants-dropzone.drag-active {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: inset 0 0 0 1px rgba(var(--primary-rgb), 0.22);
}

.participants-dropzone:focus-visible {
  outline: 2px solid rgba(var(--primary-rgb), 0.4);
  outline-offset: 2px;
}

.import-help-text {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.82rem;
}

.participants-import-status {
  margin: 0;
  font-size: 0.86rem;
  font-weight: 700;
}

.participants-import-status.success {
  color: #248a43;
}

.participants-import-status.error {
  color: #c43d34;
}

.participants-list h4 {
  margin: 0 0 0.85rem;
}

.participants-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  margin-bottom: 0.85rem;
  flex-wrap: wrap;
}

.participants-list-head h4 {
  margin: 0;
}

.participants-clear-button {
  min-height: 40px;
  padding: 0.5rem 0.8rem;
  border-radius: 11px;
  border: 1px solid rgba(191, 63, 78, 0.24);
  background: #fff6f6;
  color: #bf3f4e;
  font-size: 0.84rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: background-color 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}

.participants-clear-button:hover:not(:disabled),
.participants-clear-button:focus-visible:not(:disabled) {
  background: #ffecee;
  border-color: rgba(191, 63, 78, 0.35);
}

.participants-clear-button:disabled {
  opacity: 0.52;
  cursor: not-allowed;
}

.participants-list ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.7rem;
}

.participants-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
}

.participant-info {
  display: grid;
  gap: 0.18rem;
}

.participant-priority-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 0.14rem 0.5rem;
  border-radius: 999px;
  border: 1px solid rgba(var(--primary-rgb), 0.24);
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.participants-list strong,
.event-line strong,
.conflict-person strong,
.summary-item strong {
  display: block;
  color: var(--text);
}

.participants-list span,
.event-line span,
.conflict-person span {
  display: block;
  color: var(--text-soft);
  font-size: 0.9rem;
}

.participants-list ul button {
  color: var(--text-soft);
  font-size: 1.2rem;
}

.participant-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.inline-link-button {
  margin-top: 0.35rem;
}

.soft-chip,
.slot-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0.65rem 0.9rem;
  border-radius: 12px;
  font-weight: 700;
}

.availability-day,
.slot-chip {
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.availability-day:hover,
.slot-chip:hover {
  transform: translateY(-1px);
}

.soft-chip {
  min-width: 52px;
  border: 1px solid var(--stroke-soft);
}

.chip-green {
  background: var(--green-soft);
  color: #28907f;
}

.chip-red {
  background: var(--red-soft);
  color: #e46a58;
}

.slot-chip {
  color: #0b68b8;
  background: var(--teal-soft);
  border: 1px solid #dbe8f8;
}

.slot-chip-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.slot-delete {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  min-width: 42px;
  padding: 0.45rem;
  border-radius: 12px;
  border: 1px solid #ffd6d2;
  background: #fff7f6;
  color: #c43d34;
}

.slot-delete:hover {
  background: #ffefed;
}

.events-card,
.inner-box {
  padding: 1rem;
  border-radius: 18px;
  border: 1px solid var(--stroke-soft);
  background: linear-gradient(180deg, #ffffff 0%, var(--surface-soft) 100%);
}

.events-card h4,
.inner-box h4 {
  margin: 0 0 0.8rem;
}

.inner-box .ghost-button {
  margin-top: 0.65rem;
}

.conflict-add-button {
  margin-top: 0.75rem;
}

.form-error {
  margin: 0.45rem 0 0;
  color: #c43d34;
  font-size: 0.9rem;
}

.event-line {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.8rem;
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--stroke-soft);
}

.event-line:last-of-type {
  border-bottom: 0;
}

.event-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.event-red {
  background: var(--danger);
}

.event-teal {
  background: var(--teal);
}

.event-violet {
  background: var(--primary);
}

.event-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.event-actions button {
  color: var(--text-soft);
  font-size: 1rem;
  border-radius: 8px;
  padding: 0.2rem 0.35rem;
}

.event-actions button:hover {
  background: var(--surface-soft);
}

.empty-exceptions,
.empty-closures {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.92rem;
}

.schedule-rules-builder {
  margin-top: 0.35rem;
}

.schedule-static-note {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.75rem 0.85rem;
  border-radius: 14px;
  border: 1px solid var(--stroke-soft);
  background: var(--primary-soft);
}

.schedule-static-note i {
  color: var(--primary);
  font-size: 1.1rem;
  margin-top: 0.1rem;
}

.schedule-static-note p {
  margin: 0;
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.45;
}

.planning-window-card {
  display: grid;
  gap: 0.55rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.planning-window-text {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.9rem;
}

.month-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.month-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0.5rem 0.8rem;
  border-radius: 11px;
  border: 1px solid var(--stroke);
  background: #fff;
  color: var(--text-soft);
  font-weight: 700;
  font-size: 0.88rem;
  transition: transform 0.12s ease, background-color 0.12s ease, border-color 0.12s ease;
}

.month-chip:hover {
  transform: translateY(-1px);
}

.month-chip.is-selected {
  color: var(--primary);
  border-color: rgba(var(--primary-rgb), 0.35);
  background: var(--primary-soft);
}

#unavailability-section .month-chip.is-selected {
  color: #d95b5b;
  border-color: #f2b4b4;
  background: #fff1f1;
}

#conflicts-section .month-chip.is-selected,
#closures-section .month-chip.is-selected {
  color: #d95b5b;
  border-color: #f2b4b4;
  background: #fff1f1;
}

#unavailability-section,
#conflicts-section,
#closures-section {
  align-self: stretch;
}

.rule-builder-grid {
  display: grid;
  gap: 0.75rem;
}

.rule-top-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
  align-items: start;
  margin-bottom: 0.80rem;
}

.rule-top-cell {
  display: grid;
  gap: 0.55rem;
}

.school-holidays-block {
  display: grid;
  gap: 0.65rem;
  margin-bottom: 0.65rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--stroke-soft);
}

#rules-builder-card .school-holidays-block h4 {
  margin: 0;
}

#rules-builder-card .rule-top-grid .rule-section-block {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

#rules-builder-card .rule-top-cell h4 {
  margin: 0;
}

.rule-action-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.65rem;
  margin-top: 0.75rem;
}

#rules-builder-card #add-rule-button {
  margin-top: 0;
}

#rules-builder-card #add-school-holidays-rule-button {
  width: auto;
  min-height: 54px;
  padding-inline: 1rem;
}

.rule-section-block {
  display: grid;
  gap: 0.55rem;
  margin-top: 0.25rem;
  padding-top: 0.7rem;
  border-top: 1px solid var(--stroke-soft);
}

.rule-section-block:first-of-type {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.rule-field {
  display: grid;
  gap: 0.35rem;
}

.rule-field span {
  display: block;
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 700;
}

.rule-field select,
.rule-field input {
  width: 100%;
}

.rule-extra-fields {
  display: grid;
  gap: 0.65rem;
}

.rule-extra-inline-grid {
  display: grid;
  gap: 0.65rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.day-filter-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: start;
}

.day-parity-row {
  justify-content: flex-start;
}

@media (max-width: 980px) {
  .rule-top-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .day-filter-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .rule-extra-inline-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.rule-fieldset {
  margin: 0;
  border: 1px solid var(--stroke-soft);
  border-radius: 14px;
  padding: 0.65rem 0.75rem 0.8rem;
}

.rule-fieldset legend {
  padding: 0 0.2rem;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 700;
}

.rule-check-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem;
}

.rule-check-grid-months {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.rule-check-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 36px;
  padding: 0.35rem 0.55rem;
  border-radius: 10px;
  border: 1px solid var(--stroke-soft);
  background: var(--card);
  color: var(--text-soft);
  font-size: 0.85rem;
  cursor: pointer;
}

.rule-check-pill:has(input:checked) {
  border-color: rgba(var(--primary-rgb), 0.35);
  background: var(--primary-soft);
  color: var(--primary);
}

.rule-check-pill input {
  margin: 0;
}

.link-button {
  margin-top: 0.4rem;
  color: var(--primary);
  font-weight: 800;
}

.inline-popup[hidden] {
  display: none;
}

.inline-popup {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.inline-popup-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(26, 35, 80, 0.36);
}

.inline-popup-card {
  position: relative;
  width: min(460px, calc(100vw - 2rem));
  border-radius: 18px;
  border: 1px solid var(--stroke);
  background: #fff;
  box-shadow: var(--shadow);
  padding: 1rem;
}

.inline-popup-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.inline-popup-head h4 {
  margin: 0;
  font-size: 1.05rem;
  color: var(--text);
}

.inline-popup-close {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  color: var(--text-soft);
  font-size: 1.2rem;
}

.inline-popup-close:hover {
  background: var(--surface-soft);
}

.inline-popup-error {
  margin: 0 0 0.65rem;
  color: #c43d34;
  font-size: 0.9rem;
}

.inline-popup-info {
  margin: 0 0 0.65rem;
  color: var(--text);
  font-size: 0.92rem;
  line-height: 1.45;
  white-space: pre-line;
}

.inline-popup-form {
  display: grid;
  gap: 0.75rem;
}

.inline-popup-fields {
  display: grid;
  gap: 0.65rem;
}

.inline-popup-field {
  display: grid;
  gap: 0.35rem;
}

.inline-popup-field label {
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 700;
}

.inline-popup-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
}

.inline-popup-actions .primary-button,
.inline-popup-actions .outline-button {
  min-height: 44px;
  padding: 0.6rem 0.95rem;
  border-radius: 12px;
}

.info-tip {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.95rem 1rem;
  border-radius: 16px;
  border: 1px solid transparent;
  line-height: 1.45;
}

.tip-teal {
  background: var(--teal-soft);
  border-color: #dbe8f8;
}

.tip-violet {
  background: var(--primary-soft);
  border-color: #dce9f9;
}

.tip-orange {
  background: var(--orange-soft);
  border-color: var(--stroke-soft);
}

.conflict-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.75rem;
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--stroke-soft);
}

.conflict-row:last-child {
  border-bottom: 0;
}

.conflict-person {
  padding: 0.8rem;
  border: 1px solid var(--stroke-soft);
  border-radius: 14px;
  background: #fff;
}

.conflict-link {
  color: var(--danger);
  font-size: 1.55rem;
  font-weight: 800;
}

.conflict-delete {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  min-width: 40px;
  border-radius: 12px;
  border: 1px solid #ffd6d2;
  background: #fff7f6;
  color: #c43d34;
  font-size: 1.05rem;
}

.conflict-delete:hover {
  background: #ffefed;
}

.conflicts-empty {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.94rem;
  text-align: center;
  padding: 0.45rem 0.2rem;
}

.cta-card {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: linear-gradient(180deg, #ffffff 0%, var(--surface-soft) 100%);
}

.calendar-illustration {
  position: relative;
  width: min(220px, 100%);
  height: 160px;
  margin: 0 auto;
}

.calendar-top {
  position: absolute;
  top: 26px;
  left: 22px;
  width: 150px;
  height: 100px;
  border: 5px solid #8cbaf0;
  border-top-width: 16px;
  border-radius: 24px;
  background: #fff;
}

.calendar-top::before,
.calendar-top::after {
  content: "";
  position: absolute;
  top: -22px;
  width: 8px;
  height: 28px;
  border-radius: 999px;
  background: var(--primary);
}

.calendar-top::before {
  left: 28px;
}

.calendar-top::after {
  right: 28px;
}

.calendar-grid {
  position: absolute;
  top: 60px;
  left: 50px;
  display: grid;
  grid-template-columns: repeat(3, 14px);
  gap: 12px;
}

.calendar-grid span {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  background: #dbe8f8;
}

.calendar-check {
  position: absolute;
  right: 18px;
  bottom: 26px;
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 1.8rem;
  box-shadow: 0 12px 24px rgba(var(--primary-rgb), 0.22);
}

.calendar-check.is-ready {
  background: var(--success);
  color: #fff;
  box-shadow: 0 12px 24px rgba(52, 199, 89, 0.28);
}

.calendar-check.is-blocked {
  background: var(--danger);
  color: #fff;
  box-shadow: 0 12px 24px rgba(255, 59, 48, 0.28);
}

.cta-copy {
  margin: 0;
  text-align: center;
  line-height: 1.65;
  font-size: 1.08rem;
}

.check-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.8rem;
}

.check-list li {
  position: relative;
  padding-left: 2rem;
  color: var(--text-soft);
  font-weight: 700;
}

.check-list li::before {
  content: "✕";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--danger);
  color: #fff;
  font-size: 0.82rem;
}

.check-list li.is-ready::before {
  content: "✓";
  background: var(--success);
}

.check-list li.is-blocked::before {
  content: "✕";
  background: var(--danger);
}

.cta-button {
  width: 100%;
  position: relative;
  overflow: hidden;
  transition: background 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease;
}

.cta-button.is-incomplete {
  background: #b7b7bd;
  box-shadow: none;
  color: #f5f5f7;
  cursor: not-allowed;
}

.cta-button.is-incomplete:hover {
  transform: none;
}

.cta-button.is-ready {
  animation: launchPulseStrong 2.1s ease-in-out infinite;
}

.cta-button.is-ready::after {
  content: "";
  position: absolute;
  top: -20%;
  left: -45%;
  width: 38%;
  height: 150%;
  transform: rotate(18deg);
  background: linear-gradient(
    120deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.42) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  animation: launchShine 2.8s linear infinite;
  pointer-events: none;
}

@keyframes launchPulseStrong {
  0%,
  100% {
    box-shadow: 0 12px 22px rgba(var(--primary-rgb), 0.2);
    transform: translateY(0) scale(1);
  }
  50% {
    box-shadow: 0 15px 26px rgba(var(--primary-rgb), 0.3);
    transform: translateY(-1px) scale(1.014);
  }
}

@keyframes launchShine {
  from {
    left: -45%;
  }
  to {
    left: 120%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cta-button.is-ready {
    animation: none;
  }

  .cta-button.is-ready::after {
    animation: none;
  }
}

.summary-bar {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)) minmax(280px, 1.4fr) auto;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
  padding: 1rem 1.2rem;
  border-radius: var(--radius-xl);
}

.summary-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
}

.summary-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background: var(--surface-soft);
  color: var(--primary);
  font-size: 1.35rem;
}

.summary-item span {
  display: block;
  margin-top: 0.15rem;
  line-height: 1.4;
}

.summary-progress {
  justify-content: space-between;
}

.progress-wrap {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 210px;
}

.progress-bar {
  position: relative;
  flex: 1;
  height: 10px;
  border-radius: 999px;
  background: #e5e5ea;
  overflow: hidden;
}

.progress-bar span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #58cd77, var(--success));
}

.planning-result-section {
  margin-top: 1rem;
  padding: 1.1rem 1.2rem 1.2rem;
  border-radius: var(--radius-xl);
  display: grid;
  gap: 1rem;
}

.planning-result-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.planning-result-head h2 {
  margin: 0;
  color: var(--text);
}

.planning-result-subtitle {
  margin: 0.35rem 0 0;
  color: var(--text-soft);
  font-weight: 600;
}

.planning-result-actions {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex-wrap: wrap;
}

.planning-result-actions .outline-button {
  min-height: 44px;
  border-radius: 12px;
  padding: 0.55rem 0.95rem;
}

.planning-result-months {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
}

.planning-month-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
}

.planning-month-title {
  margin: 0;
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  background: var(--surface-soft);
}

.planning-month-table {
  width: 100%;
  border-collapse: collapse;
}

.planning-month-table th,
.planning-month-table td {
  border-bottom: 1px solid var(--border);
  padding: 0.55rem 0.65rem;
  vertical-align: top;
}

.planning-month-table thead th {
  color: var(--text);
  font-weight: 800;
  font-size: 0.9rem;
  background: #f7f7f8;
}

.planning-month-table tbody tr:last-child td {
  border-bottom: 0;
}

.planning-week-separator td {
  padding: 0.42rem 0.65rem;
  background: #f3f6fa;
  color: var(--text);
  font-size: 0.83rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  border-top: 2px solid var(--stroke);
  border-bottom: 1px solid var(--stroke-soft);
}

.planning-day-label {
  color: var(--text);
  font-weight: 700;
  white-space: nowrap;
}

.planning-day-participants {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.planning-day-participants.is-blocked-row,
.planning-day-participants.is-centered-row {
  justify-content: center;
}

.planning-person-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.24rem 0.48rem;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 700;
}

.planning-person-chip.is-priority {
  background: #fff1cf;
}

.planning-person-chip.is-blocked {
  background: #ffe7eb;
  border: 1px solid #f8c2cb;
  color: #a03047;
  min-width: 260px;
  justify-content: center;
  text-align: center;
  padding: 0.26rem 0.75rem;
}

.planning-person-chip.is-no-session {
  background: #e7f8ee;
  border: 1px solid #bfe9cc;
  color: #2b7f56;
  min-width: 260px;
  justify-content: center;
  text-align: center;
  padding: 0.26rem 0.75rem;
}

@media (max-width: 1200px) {
  .planning-person-chip.is-blocked,
  .planning-person-chip.is-no-session {
    min-width: 220px;
  }
}

.planning-day-count {
  color: var(--text-soft);
  font-weight: 700;
  font-size: 0.85rem;
  text-align: center;
}

.planning-empty-day {
  color: var(--text-soft);
  font-style: italic;
}

.planning-result-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.65rem;
}

.planning-kpi {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.65rem 0.75rem;
  background: #fff;
}

.planning-kpi strong {
  display: block;
  color: var(--text);
}

.planning-kpi span {
  display: block;
  margin-top: 0.12rem;
  color: var(--text-soft);
  font-size: 0.88rem;
}

.planning-result-success {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 0.9rem;
  border-radius: 12px;
  background: var(--green-soft);
  border: 1px solid #cfead5;
}

.planning-result-success i {
  color: #248a43;
  font-size: 1.25rem;
}

.planning-result-success p {
  margin: 0;
  color: #1f6f38;
  font-weight: 700;
}

@media (max-width: 1320px) {
  .stepper-card {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.55rem;
    padding: 0.95rem 1rem;
    align-items: start;
  }

  .step-arrow {
    display: none;
  }

  .step-item {
    min-width: 0;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 0.55rem;
  }

  .step-number {
    width: 46px;
    height: 46px;
    font-size: 1.4rem;
  }

  .step-item h3 {
    font-size: 1.02rem;
    line-height: 1.08;
  }

  .step-item p {
    margin-top: 0.18rem;
    font-size: 0.82rem;
    line-height: 1.18;
  }

  .hero {
    grid-template-columns: minmax(0, 1fr) minmax(320px, 460px);
    padding: 1.2rem;
  }

  .dashboard-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas: none;
    align-items: start;
  }

  .dashboard-grid > .panel-card:first-of-type,
  #closures-section,
  #unavailability-section,
  #conflicts-section,
  .dashboard-grid > .cta-card {
    grid-area: auto;
  }

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

  .secondary-button {
    width: 100%;
  }

  .planning-result-months {
    grid-template-columns: 1fr;
  }

  .planning-result-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1120px) {
  .stepper-card {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.7rem;
  }
}

@media (max-width: 980px) {
  .page-shell {
    padding: 1rem;
  }

  .hero {
    grid-template-columns: 1fr;
    gap: 1rem;
    padding: 1rem;
  }

  .stepper-card {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .dashboard-grid,
  .summary-bar {
    grid-template-columns: 1fr;
  }

  .planning-result-head {
    flex-direction: column;
  }

  .planning-result-actions {
    width: 100%;
  }

  .planning-result-actions .outline-button {
    flex: 1 1 240px;
  }

  .panel-head-between {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (max-width: 720px) {
  .hero-copy p {
    font-size: 1rem;
  }

  .role-grid,
  .role-grid-compact {
    grid-template-columns: 1fr;
  }

  .rule-extra-inline-grid {
    grid-template-columns: 1fr;
  }

  .rule-action-row {
    grid-template-columns: 1fr;
  }

  #rules-builder-card #add-school-holidays-rule-button {
    width: 100%;
  }

  .conflict-row {
    grid-template-columns: 1fr;
    justify-items: stretch;
  }

  .conflict-link,
  .conflict-delete {
    justify-self: center;
  }

  .participants-clear-button {
    width: 100%;
  }

  .planning-result-kpis {
    grid-template-columns: 1fr;
  }

  .progress-wrap {
    width: 100%;
    min-width: 0;
  }
}
