.calendar-richtext-shell {
  display: grid;
  gap: 10px;
}

.calendar-richtext-shell .rich-toolbar {
  width: 100%;
}

.calendar-richtext-shell .rich-history-menu {
  position: relative;
}

.calendar-richtext-shell .rich-history-pop {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 30;
  width: min(320px, calc(100vw - 48px));
  max-height: 320px;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.16);
}

.calendar-richtext-shell .rich-history-head {
  padding: 0.8rem 0.95rem 0.55rem;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(71, 85, 105, 0.88);
}

.calendar-richtext-shell .rich-history-list {
  display: grid;
  gap: 6px;
  max-height: 265px;
  padding: 0 0.45rem 0.55rem;
  overflow: auto;
}

.calendar-richtext-shell .rich-history-item,
.calendar-richtext-shell .rich-history-empty {
  border-radius: 12px;
}

.calendar-richtext-shell .rich-history-item {
  width: 100%;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(248, 250, 252, 0.95);
  padding: 0.65rem 0.75rem;
  text-align: left;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.calendar-richtext-shell .rich-history-item:hover,
.calendar-richtext-shell .rich-history-item:focus-visible {
  border-color: rgba(14, 165, 233, 0.38);
  background: rgba(239, 246, 255, 0.98);
  transform: translateY(-1px);
}

.calendar-richtext-shell .rich-history-item.is-current {
  border-color: rgba(14, 165, 233, 0.42);
  background: rgba(224, 242, 254, 0.92);
}

.calendar-richtext-shell .rich-history-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.3rem;
  font-size: 0.76rem;
}

.calendar-richtext-shell .rich-history-item-head strong {
  font-size: 0.8rem;
  color: rgba(15, 23, 42, 0.92);
}

.calendar-richtext-shell .rich-history-item-head span {
  color: rgba(100, 116, 139, 0.86);
  white-space: nowrap;
}

.calendar-richtext-shell .rich-history-item-preview,
.calendar-richtext-shell .rich-history-empty {
  display: block;
  font-size: 0.76rem;
  line-height: 1.45;
  color: rgba(71, 85, 105, 0.9);
}

.calendar-richtext-shell .rich-history-empty {
  padding: 0.75rem;
  background: rgba(248, 250, 252, 0.95);
}

.calendar-richtext-shell [data-rich-hint] {
  position: relative;
}

.calendar-richtext-shell [data-rich-hint]::after {
  content: attr(data-rich-hint);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  transform: translate(-50%, 4px);
  min-width: max-content;
  max-width: 220px;
  padding: 0.38rem 0.55rem;
  border-radius: 9px;
  background: rgba(15, 23, 42, 0.94);
  color: #fff;
  font-size: 0.72rem;
  line-height: 1.2;
  letter-spacing: 0.01em;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s ease, transform 0.16s ease;
  z-index: 35;
}

.calendar-richtext-shell [data-rich-hint]:hover::after,
.calendar-richtext-shell [data-rich-hint]:focus-within::after,
.calendar-richtext-shell [data-rich-hint]:focus-visible::after {
  opacity: 1;
  transform: translate(-50%, 0);
}

.calendar-richtext-shell .rich-slider-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
}

.calendar-richtext-shell .rich-slider-icon svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.calendar-richtext-shell .rich-editor-wrap {
  min-height: 220px;
}

.calendar-richtext-shell .rich-editor {
  min-height: 180px;
}

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

.calendar-richtext-source {
  display: none !important;
}

.calendar-richtext-shell .rich-editor > :first-child,
.calendar-public-copy > :first-child,
.calendar-public-copy .translation-text > :first-child {
  margin-top: 0;
}

.calendar-richtext-shell .rich-editor > :last-child,
.calendar-public-copy > :last-child,
.calendar-public-copy .translation-text > :last-child {
  margin-bottom: 0;
}

.calendar-richtext-shell .rich-editor p,
.calendar-richtext-shell .rich-editor div,
.calendar-public-copy p,
.calendar-public-copy div {
  margin: 0 0 0.75rem;
}

.calendar-richtext-shell .rich-editor h1,
.calendar-richtext-shell .rich-editor h2,
.calendar-richtext-shell .rich-editor h3,
.calendar-richtext-shell .rich-editor h4,
.calendar-richtext-shell .rich-editor h5,
.calendar-richtext-shell .rich-editor h6,
.calendar-public-copy h1,
.calendar-public-copy h2,
.calendar-public-copy h3,
.calendar-public-copy h4,
.calendar-public-copy h5,
.calendar-public-copy h6 {
  margin: 0 0 0.6rem;
  line-height: 1.2;
}

.calendar-richtext-shell .rich-editor ul,
.calendar-richtext-shell .rich-editor ol,
.calendar-public-copy ul,
.calendar-public-copy ol {
  margin: 0 0 0.85rem;
  padding-left: 1.35rem;
}

.calendar-richtext-shell .rich-editor li + li,
.calendar-public-copy li + li {
  margin-top: 0.2rem;
}

.calendar-richtext-shell .rich-editor blockquote,
.calendar-public-copy blockquote {
  margin: 0 0 0.85rem;
  padding: 0.2rem 0 0.2rem 0.95rem;
  border-left: 3px solid rgba(14, 165, 233, 0.35);
  color: rgba(44, 52, 68, 0.78);
}

.calendar-richtext-shell .rich-editor a,
.calendar-public-copy a {
  color: inherit;
  text-decoration: underline;
}

body.theme-dark .calendar-richtext-shell .rich-editor blockquote,
body.theme-dark .calendar-public-copy blockquote {
  color: rgba(226, 232, 240, 0.82);
  border-left-color: rgba(56, 189, 248, 0.42);
}

body.theme-dark .calendar-richtext-shell .rich-history-pop {
  border-color: rgba(71, 85, 105, 0.5);
  background: rgba(15, 23, 42, 0.96);
  box-shadow: 0 18px 42px rgba(2, 6, 23, 0.45);
}

body.theme-dark .calendar-richtext-shell .rich-history-head,
body.theme-dark .calendar-richtext-shell .rich-history-item-head strong,
body.theme-dark .calendar-richtext-shell .rich-history-item-head span,
body.theme-dark .calendar-richtext-shell .rich-history-item-preview,
body.theme-dark .calendar-richtext-shell .rich-history-empty {
  color: rgba(226, 232, 240, 0.82);
}

body.theme-dark .calendar-richtext-shell .rich-history-item {
  border-color: rgba(71, 85, 105, 0.4);
  background: rgba(30, 41, 59, 0.92);
}

body.theme-dark .calendar-richtext-shell .rich-history-item.is-current {
  border-color: rgba(56, 189, 248, 0.55);
  background: rgba(12, 74, 110, 0.45);
}
