:root {
  --bg: #f7f2eb;
  --paper: rgba(255, 255, 255, 0.78);
  --paper-solid: #ffffff;
  --text: #1f2a37;
  --muted: #738196;
  --line: rgba(31, 42, 55, 0.08);
  --blue: #4a8af4;
  --blue-deep: #2f6fe0;
  --green-bg: #edf8ea;
  --green-line: #c6e8bf;
  --blue-bg: #eef4ff;
  --blue-line: #c9d8ff;
  --sand-bg: #fff4e1;
  --sand-line: #f1d5a6;
  --danger: #ef5350;
  --shadow: 0 24px 70px rgba(68, 55, 33, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Bahnschrift", "Segoe UI Variable Text", "Trebuchet MS", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(91, 145, 255, 0.12), transparent 30%),
    radial-gradient(circle at bottom right, rgba(255, 187, 92, 0.18), transparent 28%),
    linear-gradient(135deg, #fbf7f1, #f2eee8 58%, #efe6db);
  min-height: 100vh;
}

.app-shell {
  width: min(1320px, calc(100% - 32px));
  margin: 32px auto;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(360px, 0.95fr);
  gap: 24px;
  align-items: start;
}

.panel,
.message-card {
  border: 1px solid rgba(255, 255, 255, 0.68);
  background: var(--paper);
  backdrop-filter: blur(18px);
  border-radius: 28px;
  box-shadow: var(--shadow);
}

.calendar-panel {
  padding: 28px;
}

.calendar-toolbar,
.message-header,
.selection-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 12px;
  font-weight: 800;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(32px, 5vw, 44px);
  line-height: 1;
}

h2 {
  font-size: 28px;
  line-height: 1.1;
}

.icon-button,
.copy-button,
.danger-button,
select,
input {
  font: inherit;
}

.icon-button {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 0;
  background: var(--paper-solid);
  box-shadow: 0 8px 20px rgba(31, 42, 55, 0.08);
  cursor: pointer;
  font-size: 24px;
}

.controls-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin: 28px 0 24px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 10px;
  color: var(--muted);
  font-weight: 700;
}

.field span {
  font-size: 14px;
}

select,
input {
  width: 100%;
  height: 56px;
  border-radius: 18px;
  border: 1px solid var(--line);
  padding: 0 16px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.92);
}

.calendar-grid {
  display: grid;
  gap: 24px;
}

.month-block {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(31, 42, 55, 0.06);
  border-radius: 24px;
  padding: 22px;
}

.month-title {
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 18px;
}

.weekdays,
.days {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 12px;
}

.weekdays {
  color: var(--muted);
  margin-bottom: 12px;
  font-weight: 700;
}

.weekday {
  text-align: center;
}

.day-button,
.day-placeholder {
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
}

.day-placeholder {
  visibility: hidden;
}

.day-button {
  border: 0;
  cursor: pointer;
  background: #f0f2f6;
  color: var(--text);
  font-size: 20px;
  transition: transform 0.18s ease, background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.day-button:hover {
  transform: translateY(-2px);
}

.day-button.is-selected {
  background: linear-gradient(180deg, var(--blue), var(--blue-deep));
  color: #fff;
  box-shadow: 0 12px 24px rgba(74, 138, 244, 0.3);
}

.selection-card {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.danger-button,
.copy-button {
  border: 0;
  border-radius: 14px;
  padding: 12px 18px;
  cursor: pointer;
  color: #fff;
  font-weight: 800;
}

.danger-button {
  background: linear-gradient(180deg, #ff6b6b, #ea433f);
}

.copy-button {
  background: linear-gradient(180deg, #59d66f, #28b24c);
}

.copy-button--accent {
  background: linear-gradient(180deg, #ff9d4f, #ff6d00);
}

.selected-dates {
  margin-top: 20px;
  display: grid;
  gap: 10px;
  max-height: 220px;
  overflow: auto;
  padding-right: 6px;
}

.selected-item {
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  font-size: 18px;
}

.stack {
  display: grid;
  gap: 18px;
}

.message-card {
  padding: 22px 22px 24px;
}

.message-card--green {
  background: linear-gradient(180deg, rgba(237, 248, 234, 0.96), rgba(237, 248, 234, 0.82));
  border-color: var(--green-line);
}

.message-card--blue {
  background: linear-gradient(180deg, rgba(238, 244, 255, 0.96), rgba(238, 244, 255, 0.82));
  border-color: var(--blue-line);
}

.message-card--sand {
  background: linear-gradient(180deg, rgba(255, 244, 225, 0.98), rgba(255, 244, 225, 0.84));
  border-color: var(--sand-line);
}

.message-text {
  margin-top: 16px;
  font-size: 18px;
  line-height: 1.55;
}

.csv-output {
  margin-top: 16px;
  font: 500 18px/1.5 "Consolas", "Courier New", monospace;
  white-space: pre-wrap;
}

@media (max-width: 1080px) {
  .layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100% - 20px, 1320px);
    margin: 18px auto;
  }

  .calendar-panel,
  .message-card {
    padding: 18px;
    border-radius: 22px;
  }

  .controls-grid {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 30px;
  }

  h2 {
    font-size: 20px;
  }

  .month-block {
    padding: 16px;
  }

  .weekdays,
  .days {
    gap: 8px;
  }

  .day-button {
    font-size: 16px;
  }

  .message-header,
  .selection-header,
  .calendar-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }
}
