.ooo-app {
  --editor-min-height: 520px;

  --font-family-base:
    'Poppins', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;

  --font-size-xs: 14px;
  --font-size-sm: 15px;
  --font-size-base: 16px;

  --font-weight-regular: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;

  --radius-xs: 2px;
  --radius-sm: 4px;
  --radius-lg: 8px;
  --radius-full: 999px;

  --color-primary: #6b72f2;
  --color-primary-subtle: #eceefd;
  --color-primary-subtle-hover: #e2e5fb;
  --color-focus-border: #80bdff;
  --color-focus-ring: rgba(0, 123, 255, 0.25);

  --color-text-strong: #1f2340;
  --color-text: #2b3152;
  --color-text-label: rgb(4, 20, 58);
  --color-text-secondary: #5c6185;
  --color-text-muted: #6b7190;
  --color-text-subtle: #7a7f9e;
  --color-text-placeholder: #9ca1b9;

  --color-surface: #fff;
  --color-surface-muted: #f5f7f9;
  --color-surface-hover: #eef1f4;
  --color-surface-hover-strong: #e6e7eb;

  --color-border: #ced4da;
  --color-border-subtle: #e6e7eb;

  --color-success: #2f9e62;
  --color-danger: #e5484d;
  --color-danger-strong: #d14343;
  --color-danger-focus-ring: rgba(229, 72, 77, 0.25);

  --color-shadow: rgba(31, 35, 64, 0.08);
  --color-shadow-subtle: rgba(43, 49, 82, 0.06);

  --space-1: 4px;
  --space-1-5: 6px;
  --space-2: 8px;
  --space-2-5: 10px;
  --space-3: 12px;
  --space-3-5: 14px;
  --space-4: 16px;
  --space-4-5: 18px;
  --space-5: 20px;
  --space-6: 24px;

  --border-width: 1px;

  --shadow-sm: 0 1px 2px var(--color-shadow-subtle);
  --shadow-md: 0 2px 8px var(--color-shadow);
  --shadow-focus: 0 0 0 0.2rem var(--color-focus-ring);
  --shadow-focus-danger: 0 0 0 0.2rem var(--color-danger-focus-ring);

  max-width: 1000px;
  margin: 0 auto;
  font-family: var(--font-family-base);
  font-size: 16px;
  font-weight: var(--font-weight-regular);
  line-height: normal;
  text-align: left;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

.ooo-app *,
.ooo-app *::before,
.ooo-app *::after {
  box-sizing: border-box;
}

.ooo-app button,
.ooo-app input,
.ooo-app select,
.ooo-app textarea {
  font: inherit;
}

.ooo-app button:focus:not(:focus-visible) {
  outline: none;
}

.ooo-app .template-editor-page__main-configuration {
  display: flex;
  flex-flow: row;
  justify-content: space-between;
  gap: var(--space-6);
}

.ooo-app [data-template-editor],
.ooo-app .template-editor-page__main-configuration {
  min-height: var(--editor-min-height);
}

.ooo-app .template-editor-page__column {
  flex: 1 1 0;
  min-width: 0;
}

.ooo-app .template-editor-page__presets {
  padding-top: var(--space-4);
}

.ooo-app .template-configurator,
.ooo-app .template-configurator__fields {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.ooo-app .template-configurator__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
}

@media screen and (max-width: 767px) {
  .ooo-app {
    --editor-min-height: 840px;
  }

  .ooo-app .template-editor-page__main-configuration {
    flex-direction: column;
  }
}

@media screen and (max-width: 575px) {
  .ooo-app {
    --editor-min-height: 910px;
  }

  .ooo-app .panel.template-editor-page__main-configuration {
    padding: var(--space-4);
  }

  .ooo-app .template-configurator__row {
    grid-template-columns: 1fr;
  }
}

.ooo-app .template-configurator__advanced {
  border-top: var(--border-width) solid var(--color-border-subtle);
}

.ooo-app .reason-selector__options {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.ooo-app .template-preset-list {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-2-5);
}

@media screen and (max-width: 991px) {
  .ooo-app .template-preset-list {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media screen and (max-width: 575px) {
  .ooo-app .template-preset-list {
    grid-template-columns: 1fr;
  }
}

.ooo-app .message-template-editor {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.ooo-app .message-template-editor__box {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 420px;
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface-muted);
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.ooo-app .message-template-editor__box:focus-within {
  border-color: var(--color-focus-border);
  box-shadow: var(--shadow-focus);
}

.ooo-app .message-template-editor__subject {
  border-bottom: var(--border-width) solid var(--color-border);
}

.ooo-app .message-template-editor__body {
  flex: 1;
}

.ooo-app .message-subject {
  display: flex;
  align-items: center;
  gap: var(--space-1-5);
  padding: var(--space-2-5) var(--space-4) var(--space-2-5) var(--space-4-5);
}

.ooo-app .message-subject__label {
  flex: none;
  margin: 0;
  font-size: var(--font-size-base);
  color: var(--color-text-label);
}

.ooo-app .message-subject__copy {
  flex: none;
}

.ooo-app .message-subject__field {
  flex: 1;
  min-width: 0;
  height: 32px;
  padding: 0 var(--space-1-5);
  border: 0;
  background: transparent;
  font: inherit;
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-strong);
  outline: none;
}

.ooo-app .message-body {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: var(--space-2);
}

.ooo-app .message-body__text {
  flex: 1;
  margin: 0;
  padding: var(--space-3) 36px var(--space-3) var(--space-3);
  border: 0;
  background: transparent;
  font-family: inherit;
  font-size: var(--font-size-base);
  line-height: 1.6;
  color: var(--color-text);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  resize: none;
  outline: none;
}

.ooo-app .message-body__copy {
  position: absolute;
  z-index: 1;
  top: 18px;
  right: 16px;
}

.ooo-app .message-editor-controls {
  display: flex;
  flex-wrap: wrap;
  row-gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: var(--font-size-xs);
  line-height: 1.2;
  color: var(--color-text-muted);
}

.ooo-app .message-editor-controls li:not(:last-child)::after {
  content: '·';
  margin: 0 var(--space-1);
}

.ooo-app .message-editor-controls__link {
  padding: 0;
  border: 0;
  border-radius: var(--radius-xs);
  background: none;
  font: inherit;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.15s ease;
}

.ooo-app .message-editor-controls__link:hover {
  color: var(--color-text);
  text-decoration: underline;
}

.ooo-app .message-editor-controls__link:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
}

.ooo-app .message-template-editor__controls {
  padding-top: var(--space-3-5);
}

.ooo-app .copy-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text);
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.ooo-app .copy-button:hover {
  background: var(--color-surface-hover-strong);
}

.ooo-app .copy-button:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
}

.ooo-app .copy-button--copied {
  color: var(--color-success);
}

.ooo-app .copy-button--error {
  color: var(--color-danger-strong);
}

.ooo-app .copy-button__icon--shake {
  animation: ooo-copy-button-shake 0.4s ease-in-out;
}

@keyframes ooo-copy-button-shake {
  0%,
  100% {
    transform: translateX(0);
  }
  20%,
  60% {
    transform: translateX(-2px);
  }
  40%,
  80% {
    transform: translateX(2px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .ooo-app .copy-button__icon--shake {
    animation: none;
  }
}

.ooo-app .copy-button__status {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.ooo-app .pill-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  padding: 0 var(--space-4-5);
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-full);
  background: var(--color-surface);
  font: inherit;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-regular);
  color: var(--color-text-label);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  outline: none;
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.ooo-app .pill-button__label {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
}

.ooo-app .pill-button__label::after {
  content: attr(data-label);
  height: 0;
  overflow: hidden;
  visibility: hidden;
  font-weight: var(--font-weight-semibold);
  user-select: none;
  pointer-events: none;
}

.ooo-app .pill-button:hover {
  background: var(--color-surface-muted);
}

.ooo-app .pill-button--selected {
  border-color: var(--color-primary);
  background: var(--color-primary-subtle);
  font-weight: var(--font-weight-semibold);
}

.ooo-app .pill-button--selected:hover {
  background: var(--color-primary-subtle-hover);
}

.ooo-app .pill-button:focus-visible {
  border-color: var(--color-focus-border);
  box-shadow: var(--shadow-focus);
}

.ooo-app .input-label {
  display: block;
  margin: 0 0 var(--space-2);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-regular);
  line-height: 1.4;
  color: var(--color-text-label);
}

.ooo-app .input-label__optional {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-regular);
}

.ooo-app .text-input__field,
.ooo-app .email-input__field {
  width: 100%;
  height: 44px;
  margin: 0;
  padding: 0 var(--space-3-5);
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  font: inherit;
  font-size: var(--font-size-base);
  color: var(--color-text);
  outline: none;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.ooo-app .text-input__field::placeholder,
.ooo-app .email-input__field::placeholder {
  color: var(--color-text-placeholder);
}

.ooo-app .text-input__field:focus,
.ooo-app .email-input__field:focus {
  border-color: var(--color-focus-border);
  box-shadow: var(--shadow-focus);
}

.ooo-app .email-input__field--invalid,
.ooo-app .email-input__field--invalid:focus {
  border-color: var(--color-danger);
}

.ooo-app .email-input__field--invalid:focus {
  box-shadow: var(--shadow-focus-danger);
}

.ooo-app .email-input__error {
  margin: var(--space-1-5) 0 0;
  font-size: var(--font-size-sm);
  line-height: 1.4;
  color: var(--color-danger);
}

.ooo-app .date-input__control {
  position: relative;
}

.ooo-app .date-input__native {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

.ooo-app .date-input__field {
  position: relative;
  width: 100%;
  height: 44px;
  margin: 0;
  padding: 0 44px 0 var(--space-3-5);
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  font: inherit;
  font-size: var(--font-size-base);
  color: var(--color-text);
  cursor: pointer;
  caret-color: transparent;
  user-select: none;
  outline: none;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.ooo-app .date-input__field::placeholder {
  color: var(--color-text-placeholder);
}

.ooo-app .date-input__field:focus {
  border-color: var(--color-focus-border);
  box-shadow: var(--shadow-focus);
}

.ooo-app .date-input__picker-button {
  position: absolute;
  top: 50%;
  right: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text);
  cursor: pointer;
  transform: translateY(-50%);
}

.ooo-app .date-input__picker-button:hover {
  background: var(--color-surface-hover);
}

.ooo-app .date-input__picker-button:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
}

.ooo-app .collapsible-section {
  margin: 0;
}

.ooo-app .collapsible-section__header {
  display: flex;
  align-items: center;
  gap: var(--space-2-5);
  width: 100%;
  padding: var(--space-3) 0;
  border: 0;
  background: none;
  font: inherit;
  text-align: left;
  cursor: pointer;
  outline: none;
}

.ooo-app .collapsible-section__header:focus-visible {
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-focus);
}

.ooo-app .collapsible-section__title {
  flex-shrink: 0;
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-regular);
  color: var(--color-text-label);
}

.ooo-app .collapsible-section__subtitle {
  min-width: 0;
  overflow: hidden;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-regular);
  color: var(--color-text-label);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ooo-app .collapsible-section__chevron {
  flex-shrink: 0;
  margin-left: auto;
  color: var(--color-text-strong);
}

.ooo-app .collapsible-section__chevron--open {
  transform: rotate(180deg);
}

.ooo-app .collapsible-section__content {
  padding-top: var(--space-2);
}

.ooo-app .panel {
  width: 100%;
  height: 100%;
  border: var(--border-width) solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
}

.ooo-app .panel--secondary {
  background-color: var(--color-surface-muted);
}

.ooo-app .panel--clickable {
  cursor: pointer;
  user-select: none;
  outline: none;
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.ooo-app .panel--clickable:hover {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-md);
}

.ooo-app .panel--secondary.panel--clickable:hover {
  background-color: var(--color-primary-subtle);
}

.ooo-app .panel--clickable:focus-visible {
  border-color: var(--color-focus-border);
  box-shadow: var(--shadow-focus);
}

.ooo-app .panel.template-preset-list__preset {
  border: 0;
  border-radius: var(--space-3);
  padding: var(--space-4);
  color: #04143a;
  font-size: 0.9rem;
  line-height: 1.5;
  text-align: left;
}

.ooo-app .template-preset-list__preset.panel--clickable:hover {
  background-color: #e5eaef;
}

.ooo-app .template-preset-list__preset.panel--clickable:hover:not(:focus-visible) {
  box-shadow: none;
}

.ooo-app .switch-bar {
  display: flex;
  gap: var(--space-1);
  width: 100%;
  padding: var(--space-1);
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface-muted);
}

.ooo-app .switch-bar__option {
  position: relative;
  display: flex;
  flex: 1 1 0;
  align-items: center;
  justify-content: center;
  min-width: 0;
  height: 40px;
  margin: 0;
  padding: 0 var(--space-3);
  border: var(--border-width) solid transparent;
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-regular);
  color: var(--color-text-label);
  cursor: pointer;
  user-select: none;
}

.ooo-app .switch-bar__option--selected {
  border-color: var(--color-border-subtle);
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
  font-weight: var(--font-weight-semibold);
}

@media screen and (max-width: 575px) {
  .ooo-app .switch-bar__option {
    padding-inline: var(--space-1);
    font-size: var(--font-size-xs);
  }
}

.ooo-app .switch-bar__option:has(.switch-bar__input:focus-visible) {
  border-color: var(--color-focus-border);
  box-shadow: var(--shadow-focus);
}

.ooo-app .switch-bar__input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}
