:root {
  color-scheme: light;
  --background: #f5f6f8;
  --surface: #ffffff;
  --surface-muted: #eef1f4;
  --border: #d7dde4;
  --text: #1d252d;
  --muted: #617080;
  --accent: #0f766e;
  --accent-dark: #0b5f59;
  --danger: #b42318;
  --danger-dark: #8f1d14;
  --shadow: 0 20px 50px rgba(29, 37, 45, 0.18);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

.app-shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0;
}

.app-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.app-header h1 {
  margin: 0;
  font-size: 32px;
  line-height: 1.1;
}

.app-header p {
  margin: 6px 0 0;
  color: var(--muted);
}

.calendar-frame {
  min-height: 720px;
  height: calc(100vh - 132px);
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.primary-button,
.secondary-button,
.danger-button,
.icon-button {
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}

.primary-button {
  background: var(--accent);
  color: #ffffff;
  padding: 10px 15px;
  font-weight: 700;
}

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

.secondary-button {
  background: var(--surface-muted);
  color: var(--text);
  padding: 10px 15px;
}

.danger-button {
  background: var(--danger);
  color: #ffffff;
  padding: 10px 15px;
}

.danger-button:hover {
  background: var(--danger-dark);
}

.icon-button {
  width: 36px;
  height: 36px;
  background: transparent;
  color: var(--muted);
  font-size: 28px;
  line-height: 1;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(20, 27, 35, 0.46);
}

.modal.is-open {
  display: flex;
}

.modal-panel {
  width: min(560px, 100%);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 22px 8px;
}

.modal-header h2 {
  margin: 0;
  font-size: 22px;
}

#event-form {
  display: grid;
  gap: 10px;
  padding: 12px 22px 22px;
}

label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  background: #ffffff;
  color: var(--text);
}

textarea {
  resize: vertical;
}

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

.form-error {
  min-height: 20px;
  margin: 0;
  color: var(--danger);
  font-size: 14px;
}

.modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 4px;
}

.action-cluster {
  display: flex;
  gap: 10px;
}

.fc .fc-button-primary {
  background: #334155;
  border-color: #334155;
}

.fc .fc-button-primary:hover,
.fc .fc-button-primary:not(:disabled).fc-button-active {
  background: var(--accent);
  border-color: var(--accent);
}

.fc-event {
  cursor: pointer;
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100% - 20px, 1180px);
    padding: 18px 0;
  }

  .app-header {
    align-items: stretch;
    flex-direction: column;
  }

  .calendar-frame {
    min-height: 620px;
    height: calc(100vh - 170px);
    padding: 10px;
  }

  .time-grid,
  .modal-actions {
    grid-template-columns: 1fr;
  }

  .modal-actions {
    align-items: stretch;
    flex-direction: column-reverse;
  }

  .action-cluster {
    flex-direction: column-reverse;
  }
}
