:root {
  --bg: #f7f6f2;
  --ink: #102a43;
  --accent: #f26419;
  --accent-2: #2a9d8f;
  --card: #ffffff;
  --danger: #b00020;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Outfit", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 12%, #ffe8d6 0, transparent 40%),
    radial-gradient(circle at 92% 88%, #d8f3dc 0, transparent 35%),
    var(--bg);
}

.layout {
  width: min(1120px, 92vw);
  margin: 0 auto;
  padding: 1.2rem 0 2rem;
  display: grid;
  gap: 1rem;
}

.card {
  background: var(--card);
  border-radius: 18px;
  padding: 1rem;
  box-shadow: 0 10px 40px rgba(16, 42, 67, 0.12);
}

.hero {
  position: relative;
  overflow: hidden;
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto -60px -60px auto;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: rgba(242, 100, 25, 0.15);
}

h1,
h2,
h3 {
  margin-top: 0;
  font-family: "Space Grotesk", sans-serif;
}

.badge {
  display: inline-block;
  margin: 0 0 0.3rem;
  background: var(--accent);
  color: #fff;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  font-size: 0.85rem;
}

.alert {
  background: #fff3f3;
  color: #7a0014;
  border-left: 6px solid var(--danger);
  padding: 0.8rem 1rem;
  border-radius: 10px;
}

.success {
  background: #f1fbf9;
  color: #0b534f;
  border-left: 6px solid var(--accent-2);
  padding: 0.8rem 1rem;
  border-radius: 10px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 180px;
  gap: 0.75rem;
}

.full-width {
  grid-column: 1 / -1;
}

label {
  display: grid;
  gap: 0.35rem;
  font-weight: 600;
}

input,
textarea,
button {
  font: inherit;
}

input,
textarea {
  border: 1px solid #d1dbe8;
  border-radius: 10px;
  padding: 0.6rem 0.7rem;
}

.button,
.button-secondary,
.button-danger {
  border: 0;
  border-radius: 12px;
  padding: 0.65rem 0.95rem;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.button:hover,
.button-secondary:hover,
.button-danger:hover {
  transform: translateY(-2px);
}

.button {
  background: linear-gradient(100deg, var(--accent), #ff9f1c);
  color: #fff;
}

.button-secondary {
  background: #e8f4f2;
  color: #0f766e;
}

.button-danger {
  background: #fde8e8;
  color: var(--danger);
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 0.8rem;
}

.mini-card {
  border: 1px solid #e8eef5;
  border-radius: 14px;
  padding: 0.8rem;
  background: #fff;
}

.inline-form {
  margin: 0.6rem 0;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.4rem;
  align-items: end;
}

.source-grid {
  display: grid;
  gap: 0.6rem;
}

.source {
  border-radius: 12px;
  padding: 0.7rem;
  border: 1px solid #d9e2ec;
}

.source.ok {
  border-color: #2a9d8f;
  background: #f1fbf9;
}

.source.warn {
  border-color: #ff9f1c;
  background: #fff8ef;
}

.source.error {
  border-color: #c1121f;
  background: #fff3f5;
}

#calendar {
  min-height: 620px;
}

.category-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.8rem;
  margin: 0.8rem 0 0;
}

.category-filter-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.55rem;
  border-radius: 999px;
  background: #f2f6fb;
  border: 1px solid #d6e2ee;
  font-size: 0.86rem;
  font-weight: 600;
  color: #16324f;
}

.category-filter-item input[type='checkbox'] {
  width: 1rem;
  height: 1rem;
  margin: 0;
}

.fc .fc-toolbar-title {
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.1rem;
}

.fc .fc-button {
  border-radius: 10px;
  border: 0;
  box-shadow: none;
}

.fc .fc-daygrid-event,
.fc .fc-timegrid-event {
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 2px 4px;
  cursor: pointer;
}

.fc .event-type-su {
  background: #1768ac !important;
  border-color: #0f4f83 !important;
  color: #ffffff !important;
}

.fc .event-type-v {
  background: #1f7a3f !important;
  border-color: #14552a !important;
  color: #ffffff !important;
}

.fc .event-type-ue {
  background: #7b2cbf !important;
  border-color: #571f89 !important;
  color: #ffffff !important;
}

.fc .event-type-s {
  background: #c46b00 !important;
  border-color: #8d4c00 !important;
  color: #ffffff !important;
}

.fc .event-type-other {
  background: #455a64 !important;
  border-color: #2f3f46 !important;
  color: #ffffff !important;
}

.fc .fc-event-main,
.fc .fc-event-title,
.fc .fc-daygrid-event .fc-event-title,
.fc .fc-list-event-title {
  white-space: normal !important;
  overflow: visible !important;
  text-overflow: clip !important;
  word-break: break-word;
}

.fc .fc-daygrid-day-events,
.fc .fc-daygrid-event-harness {
  margin: 0;
}

.fc .fc-timegrid-event .fc-event-main,
.fc .fc-timegrid-event .fc-event-main-frame {
  height: 100%;
}

.fc-readable-event {
  display: grid;
  gap: 2px;
  line-height: 1.2;
  white-space: normal;
}

.fc-readable-time {
  font-size: 0.72rem;
  font-weight: 700;
  opacity: 0.95;
}

.fc-readable-title {
  font-size: 0.9rem;
  font-weight: 500;
  word-break: break-word;
  white-space: normal;
}

.fc-readable-room {
  font-size: 0.82rem;
  font-weight: 600;
  opacity: 0.92;
  white-space: normal;
  word-break: break-word;
}

.fc-readable-title-large {
  font-size: 1.1rem;
  font-weight: 700;
  word-break: break-word;
  white-space: normal;
  margin-bottom: 2px;
}

.fc-readable-event-day {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.fc-readable-docent-left {
  font-size: 0.86rem;
  font-weight: 600;
  opacity: 0.92;
  white-space: normal;
  word-break: break-word;
  margin-bottom: 4px;
}

.fc-readable-meta-bottom {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 0.5rem;
  margin-top: auto;
  width: 100%;
}

.fc-readable-timespan-right {
  font-size: 0.86rem;
  font-weight: 600;
  flex-shrink: 0;
  text-align: right;
  opacity: 0.92;
  white-space: nowrap;
  word-break: break-word;
}

.fc-readable-room-bottom {
  font-size: 0.86rem;
  font-weight: 600;
  flex: 1;
  min-width: 0;
  opacity: 0.92;
  white-space: normal;
  word-break: break-word;
}

body.modal-open {
  overflow: hidden;
}

.event-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
}

.event-modal.hidden {
  display: none;
}

.event-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 20, 35, 0.55);
  backdrop-filter: blur(2px);
}

.event-modal-card {
  position: relative;
  width: min(640px, 92vw);
  background: #fff;
  border-radius: 16px;
  padding: 1rem 1rem 1.1rem;
  box-shadow: 0 28px 60px rgba(16, 42, 67, 0.28);
  z-index: 1;
}

.event-modal-close {
  position: absolute;
  top: 0.45rem;
  right: 0.6rem;
  border: 0;
  background: transparent;
  font-size: 1.7rem;
  line-height: 1;
  cursor: pointer;
  color: #4b5d73;
}

.event-modal-label {
  margin: 0 0 0.4rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #5f738a;
}

.event-modal-card h3 {
  margin: 0 0 0.45rem;
  padding-right: 1.8rem;
}

.event-modal-time,
.event-modal-date,
.event-modal-id {
  margin: 0.2rem 0;
  font-weight: 600;
  color: #324c64;
}

.event-modal-description {
  margin-top: 0.7rem;
  line-height: 1.45;
  white-space: pre-wrap;
  color: #16324f;
  background: #f7fbff;
  border: 1px solid #d7e5f3;
  border-radius: 10px;
  padding: 0.7rem;
  max-height: 44vh;
  overflow: auto;
}

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

@media (max-width: 768px) {
  .layout {
    width: 96vw;
    padding-top: 0.7rem;
  }

  .form-grid,
  .inline-form {
    grid-template-columns: 1fr;
  }

  .card {
    padding: 0.75rem;
    border-radius: 14px;
  }

  .hero h1 {
    font-size: 1.25rem;
    margin-bottom: 0.4rem;
  }

  .hero p {
    margin-bottom: 0.2rem;
    font-size: 0.92rem;
  }

  #calendar {
    min-height: 560px;
  }

  .category-filters {
    gap: 0.4rem;
  }

  .category-filter-item {
    font-size: 0.8rem;
    padding: 0.3rem 0.5rem;
  }

  .fc .fc-toolbar {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.4rem;
  }

  .fc .fc-toolbar-chunk {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.35rem;
  }

  .fc .fc-button {
    padding: 0.4rem 0.55rem;
    font-size: 0.78rem;
    line-height: 1.1;
    min-height: 34px;
  }

  .fc .fc-toolbar-title {
    font-size: 0.92rem;
    text-align: center;
  }

  .fc .fc-col-header-cell-cushion,
  .fc .fc-daygrid-day-number {
    font-size: 0.78rem;
    padding: 0.2rem;
  }

  .fc .fc-timegrid-slot-label-cushion,
  .fc .fc-timegrid-axis-cushion {
    font-size: 0.72rem;
  }

  .fc-readable-time {
    font-size: 0.68rem;
  }

  .fc-readable-title {
    font-size: 0.72rem;
  }

  .fc-readable-room {
    font-size: 0.68rem;
  }

  .event-modal-card {
    width: min(94vw, 640px);
    max-height: 88vh;
    padding: 0.9rem 0.8rem 0.9rem;
    overflow: auto;
  }
}
