.user-calendar {
  --ucal-accent: #347a73;
  --ucal-accent-hover: #2c6963;
  --ucal-accent-soft: #eaf5f3;
  --ucal-text: #202020;
  --ucal-muted: #8b8b8b;
  --ucal-border: #d8d8d8;
  --ucal-danger: #b84848;
  --ucal-bg: #fff;
  --ucal-radius: 18px;

  color: var(--ucal-text);
  font: inherit;
  width: 100%;
  box-sizing: border-box;
}

.user-calendar *,
.user-calendar *::before,
.user-calendar *::after {
  box-sizing: border-box;
}

.user-calendar [hidden] {
  display: none !important;
}


/* ============================================================
   Header
   ============================================================ */

.ucal__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin: 0 0 22px;
}

.ucal__title {
  margin: 0 0 7px;
  font: inherit;
  font-size: 28px;
  line-height: 1.2;
  font-weight: 700;
  color: var(--ucal-text);
}

.ucal__lead {
  margin: 0;
  color: var(--ucal-muted);
  font-size: 16px;
  line-height: 1.45;
}


/* ============================================================
   Buttons
   ============================================================ */

.ucal__add,
.ucal__save {
  appearance: none;
  -webkit-appearance: none;

  border: 0;
  background: var(--ucal-accent);
  color: #fff;

  min-height: 46px;
  padding: 0 20px;

  border-radius: 999px;

  font: inherit;
  font-size: 16px;

  cursor: pointer;
  white-space: nowrap;

  transition:
    background-color .18s ease,
    opacity .18s ease,
    transform .18s ease;
}

.ucal__add:hover,
.ucal__save:hover {
  background: var(--ucal-accent-hover);
}

.ucal__add:active,
.ucal__save:active {
  transform: translateY(1px);
}

.ucal__add span {
  font-size: 23px;
  line-height: 0;
  margin-left: 7px;
}


/* ============================================================
   Status
   ============================================================ */

.ucal__status {
  margin: 0 0 16px;
  padding: 12px 15px;

  border-radius: 12px;

  background: #fff4f4;
  color: #9d3232;
}

.ucal__email-warning {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;

  margin: 0 0 16px;
  padding: 13px 15px;

  border: 1px solid #ead8a5;
  border-radius: 12px;

  background: #fff8e5;
  color: #6f5a20;
}

.ucal__email-warning button {
  flex: 0 0 auto;
  padding: 0;

  border: 0;

  background: transparent;
  color: var(--ucal-accent);

  font: inherit;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;

  cursor: pointer;
}


/* ============================================================
   List
   ============================================================ */

.ucal__list {
  display: grid;
  gap: 12px;
}

.ucal__empty {
  border: 1px solid var(--ucal-border);
  border-radius: var(--ucal-radius);

  padding: 28px;

  color: var(--ucal-muted);
  background: #fff;
}


/* ============================================================
   Event card
   ============================================================ */

.ucal__card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;

  border: 1px solid var(--ucal-border);
  border-radius: var(--ucal-radius);

  padding: 18px 20px;

  background: #fff;

  align-items: center;
}

.ucal__card-title {
  margin: 0 0 6px;

  font-size: 18px;
  font-weight: 600;
}

.ucal__card-desc {
  margin: 0 0 8px;

  color: var(--ucal-muted);

  white-space: pre-line;
}

.ucal__card-meta {
  display: flex;
  flex-wrap: wrap;

  gap: 8px 16px;

  color: #656565;
  font-size: 14px;
}

.ucal__card-date {
  margin-bottom: 8px;

  font-size: 18px;
  font-weight: 600;

  color: var(--ucal-accent);

  text-align: right;
}

.ucal__edit {
  border: 1px solid var(--ucal-accent);

  background: #fff;
  color: var(--ucal-accent);

  min-height: 36px;
  padding: 0 14px;

  border-radius: 999px;

  font: inherit;

  cursor: pointer;

  transition:
    background-color .18s ease,
    color .18s ease;
}

.ucal__edit:hover {
  background: var(--ucal-accent-soft);
}


/* ============================================================
   Modal
   ============================================================ */

.ucal__modal {
  position: fixed;
  inset: 0;

  z-index: 100000;

  display: grid;
  place-items: center;

  padding: 20px;
}

.ucal__backdrop {
  position: absolute;
  inset: 0;

  border: 0;

  background: rgba(245, 245, 245, .72);

  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);

  cursor: default;
}

.ucal__dialog {
  position: relative;
  z-index: 1;

  width: min(760px, 100%);
  max-height: calc(100vh - 40px);

  overflow: auto;

  background: #fff;

  border: 1px solid #9c9c9c;
  border-radius: 22px;

  box-shadow: 0 18px 50px rgba(0, 0, 0, .18);

  padding: 24px;
}

.ucal__close {
  position: absolute;

  right: 18px;
  top: 14px;

  width: 38px;
  height: 38px;

  border: 0;

  background: transparent;
  color: #7f7f7f;

  font-size: 30px;
  line-height: 1;

  cursor: pointer;
}

.ucal__dialog-title {
  margin: 0 44px 22px 0;

  font: inherit;

  font-size: 22px;
  line-height: 1.25;
  font-weight: 600;

  color: #686868;
}

.ucal__star {
  color: var(--ucal-accent);
}


/* ============================================================
   Form
   ============================================================ */

.ucal__form {
  display: grid;
  gap: 15px;
}

.ucal__field {
  display: grid;
  gap: 7px;

  margin: 0;

  width: 100%;
  max-width: none;

  color: var(--ucal-text);
}

.ucal__label {
  font-size: 14px;
  font-weight: 600;
}

.ucal__label small {
  color: var(--ucal-muted);
  font-weight: 400;
}


/* ============================================================
   Inputs
   ============================================================ */

.ucal__input {
  width: 100%;
  min-width: 0;
  min-height: 46px;

  border: 1px solid #9f9f9f;
  border-radius: 13px;

  background-color: #fff;

  color: var(--ucal-text);

  padding: 10px 13px;

  font: inherit;
  font-size: 16px;
  line-height: 1.3;

  outline: none;
  box-shadow: none;
}

.ucal__input:focus {
  border-color: var(--ucal-accent);

  box-shadow:
    0 0 0 3px rgba(52, 122, 115, .12);
}


/* ============================================================
   Select
   ============================================================ */

/*
 * Для select отключаем системный шеврон и рисуем собственный.
 *
 * padding-right оставляет достаточно места под иконку.
 * background-position задаёт отступ стрелки от правого края.
 */
select.ucal__input {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;

  padding-left: 13px;
  padding-right: 48px;

  background-color: #fff;

  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9' fill='none'%3E%3Cpath d='M1 1.5L7 7.5L13 1.5' stroke='%23202020' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");

  background-repeat: no-repeat;

  /*
   * 18px — внутренний отступ стрелки справа.
   */
  background-position: right 18px center;

  background-size: 14px 9px;

  cursor: pointer;
}

/*
 * Старый Edge / IE.
 */
select.ucal__input::-ms-expand {
  display: none;
}

/*
 * На disabled-селекте сохраняем визуальную читаемость.
 */
select.ucal__input:disabled {
  cursor: not-allowed;

  color: #979797;

  background-color: #f5f5f5;

  opacity: 1;
}


/* ============================================================
   Textarea
   ============================================================ */

.ucal__textarea {
  min-height: 78px;
  resize: vertical;
}


/* ============================================================
   Date grid
   ============================================================ */

.ucal__grid {
  display: grid;
  gap: 12px;
}

.ucal__grid--date {
  grid-template-columns:
    130px
    minmax(180px, 1fr)
    150px;
}


/* ============================================================
   Hints
   ============================================================ */

.ucal__hint {
  margin: 10px 0 0;

  color: var(--ucal-muted);

  font-size: 13px;
  line-height: 1.4;
  
}


/* ============================================================
   Custom reminder
   ============================================================ */

.ucal__custom {
  padding: 15px;

  border-radius: 15px;

  background: var(--ucal-accent-soft);
}


/* ============================================================
   Toggle
   ============================================================ */

.ucal__switch-row {
  display: flex;
  align-items: center;

  gap: 10px;

  width: max-content;
  max-width: 100%;

  cursor: pointer;
}

.ucal__switch-row input {
  position: absolute;

  opacity: 0;

  pointer-events: none;
}

.ucal__switch {
  position: relative;

  width: 38px;
  height: 22px;

  flex: 0 0 auto;

  border-radius: 999px;

  background: #c9c9c9;

  transition: .2s;
}

.ucal__switch::after {
  content: "";

  position: absolute;

  width: 16px;
  height: 16px;

  left: 3px;
  top: 3px;

  border-radius: 50%;

  background: #fff;

  transition: .2s;

  box-shadow:
    0 1px 3px rgba(0, 0, 0, .2);
}

.ucal__switch-row input:checked + .ucal__switch {
  background: var(--ucal-accent);
}

.ucal__switch-row input:checked + .ucal__switch::after {
  transform: translateX(16px);
}

.ucal__switch-row input:focus-visible + .ucal__switch {
  outline: 3px solid rgba(52, 122, 115, .25);
  outline-offset: 2px;
}


/* ============================================================
   Form error
   ============================================================ */

.ucal__form-error {
  padding: 11px 13px;

  border-radius: 10px;

  background: #fff1f1;
  color: #a83434;
}


/* ============================================================
   Actions
   ============================================================ */

.ucal__actions {
  display: flex;
  align-items: center;

  gap: 10px;

  padding-top: 4px;
}

.ucal__actions-spacer {
  flex: 1;
}

.ucal__cancel,
.ucal__delete {
  min-height: 42px;

  padding: 0 16px;

  border-radius: 999px;

  font: inherit;

  cursor: pointer;

  background: #fff;
}

.ucal__cancel {
  border: 1px solid var(--ucal-border);

  color: #555;
}

.ucal__delete {
  border: 1px solid #e4b3b3;

  color: var(--ucal-danger);
}

.ucal__save {
  min-height: 42px;
}

.ucal__save:disabled {
  opacity: .45;

  cursor: not-allowed;
}


/* ============================================================
   Mobile
   ============================================================ */

@media (max-width: 720px) {

  .ucal__top {
    display: grid;
  }

  .ucal__email-warning {
    align-items: flex-start;
    flex-direction: column;
  }

  .ucal__add {
    width: 100%;
  }

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

  .ucal__card-date {
    text-align: left;
  }

  .ucal__grid--date {
    grid-template-columns: 1fr 1fr;
  }

  .ucal__grid--date .ucal__field:last-child {
    grid-column: 1 / -1;
  }

  .ucal__dialog {
    padding: 20px 16px;

    border-radius: 18px;
  }

  .ucal__actions {
    flex-wrap: wrap;
  }

  .ucal__actions-spacer {
    display: none;
  }

  .ucal__delete {
    margin-right: auto;
  }

  /*
   * На мобильном немного увеличиваем правую зону select,
   * чтобы стрелка не прижималась к границе и по ней было
   * визуально удобно ориентироваться.
   */
  select.ucal__input {
    padding-right: 46px;

    background-position: right 16px center;
  }
}
