* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  background: #000;
  color: #f5f5f5;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 14px;
}

button,
input,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
  text-decoration: none;
}


/* SIDEBAR */

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 230px;
  background: #000;
  border-right: 1px solid #1d1d1d;
  display: flex;
  flex-direction: column;
  z-index: 100;
}

.sidebar-brand {
  padding: 28px 24px 30px;
  border-bottom: 1px solid #1d1d1d;
}

.brand-name {
  font-size: 16px;
  line-height: 1;
  letter-spacing: .16em;
  font-weight: 700;
}

.brand-label {
  margin-top: 8px;
  color: #777;
  font-size: 9px;
  letter-spacing: .18em;
  line-height: 1;
}

.nav {
  display: flex;
  flex-direction: column;
  padding: 18px 0;
  flex: 1;
}

.nav-item {
  position: relative;
  min-height: 44px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  color: #777;
  font-size: 13px;
  transition:
    color .18s ease,
    background .18s ease;
}

.nav-item:hover {
  color: #fff;
  background: #080808;
}

.nav-item.active {
  color: #fff;
}

.nav-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #fff;
}

.signout-button {
  width: 100%;
  min-height: 54px;
  padding: 0 24px;
  border: 0;
  border-top: 1px solid #1d1d1d;
  background: transparent;
  color: #666;
  text-align: left;
  cursor: pointer;
  font-size: 12px;
}

.signout-button:hover {
  color: #fff;
}


/* MOBILE HEADER */

.mobile-header {
  display: none;
}

.menu-button {
  width: 42px;
  height: 42px;
  border: 0;
  background: transparent;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  padding: 8px;
  cursor: pointer;
}

.menu-button span {
  display: block;
  width: 20px;
  height: 1px;
  background: #fff;
}

.mobile-brand {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.mobile-brand .brand-name {
  font-size: 13px;
}

.mobile-brand .brand-label {
  margin-top: 6px;
}


/* MAIN */

.main {
  min-height: 100vh;
  margin-left: 230px;
  padding: 46px 56px 90px;
}


/* HEADER */

.page-header {
  padding-bottom: 34px;
  border-bottom: 1px solid #1d1d1d;
}

.back-button {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: #666;
  font-size: 12px;
  margin-bottom: 34px;
}

.back-button:hover {
  color: #fff;
}

.back-arrow {
  font-size: 16px;
}

.eyebrow {
  margin: 0 0 12px;
  color: #666;
  font-size: 10px;
  letter-spacing: .18em;
}

.page-header h1 {
  margin: 0;
  font-size: clamp(30px, 4vw, 48px);
  line-height: 1.05;
  letter-spacing: -.04em;
  font-weight: 400;
}

.page-description {
  margin: 16px 0 0;
  max-width: 620px;
  color: #666;
  font-size: 13px;
  line-height: 1.7;
}


/* COMPOSE */

.compose-section {
  width: 100%;
  max-width: 1000px;
  padding-top: 42px;
}

.field {
  border-bottom: 1px solid #1d1d1d;
  padding-bottom: 18px;
  margin-bottom: 20px;
}

.field-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 11px;
}

.field label {
  display: block;
  color: #666;
  font-size: 10px;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.field-heading > label {
  margin: 0;
}

.field input {
  display: block;
  width: 100%;
  height: 38px;
  padding: 0;
  border: 0;
  outline: 0;
  border-radius: 0;
  background: transparent;
  color: #eee;
}

.field input::placeholder {
  color: #3f3f3f;
}

.field input:focus {
  color: #fff;
}

.field-help {
  margin: 8px 0 0;
  color: #444;
  font-size: 11px;
  line-height: 1.5;
}


/* ALL USERS */

.all-users-option {
  display: inline-flex !important;
  align-items: center;
  gap: 9px;
  color: #aaa !important;
  cursor: pointer;
  letter-spacing: 0 !important;
  text-transform: none !important;
  font-size: 12px !important;
  white-space: nowrap;
}

.all-users-option input {
  width: 14px;
  height: 14px;
  margin: 0;
  padding: 0;
  accent-color: #fff;
  cursor: pointer;
}

.all-users-option span {
  color: #aaa;
}

.all-users-option:hover span {
  color: #fff;
}

.all-users-notice {
  margin-top: 14px;
  padding: 14px 0;
  border-top: 1px solid #181818;
  color: #aaa;
  font-size: 12px;
  line-height: 1.6;
}

.recipient-disabled {
  color: #444 !important;
  cursor: not-allowed;
}


/* BODY */

.body-section {
  margin-top: 42px;
  border-top: 1px solid #1d1d1d;
}

.body-header {
  min-height: 92px;
  padding: 24px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid #1d1d1d;
}

.body-header .eyebrow {
  margin-bottom: 9px;
}

.body-header h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 400;
  letter-spacing: -.02em;
}

.body-mode {
  display: flex;
  border-bottom: 1px solid #333;
}

.mode-button {
  min-height: 36px;
  padding: 0 16px;
  border: 0;
  border-bottom: 1px solid transparent;
  margin-bottom: -1px;
  background: transparent;
  color: #555;
  cursor: pointer;
  font-size: 12px;
}

.mode-button:hover {
  color: #aaa;
}

.mode-button.active {
  color: #fff;
  border-bottom-color: #fff;
}

.editor-container {
  padding-top: 20px;
}

.body-editor {
  display: block;
  width: 100%;
  min-height: 350px;
  padding: 20px;
  border: 1px solid #1d1d1d;
  outline: 0;
  border-radius: 0;
  background: #050505;
  color: #ddd;
  resize: vertical;
  font-size: 13px;
  line-height: 1.7;
}

.body-editor:focus {
  border-color: #444;
  color: #fff;
}

.html-editor {
  font-family: Consolas, Monaco, "Courier New", monospace;
}

.plain-editor {
  font-family: Arial, Helvetica, sans-serif;
}

.body-editor::placeholder {
  color: #3f3f3f;
}

.editor-help {
  margin: 8px 0 0;
  color: #444;
  font-size: 11px;
}


/* PREVIEW */

.preview-section {
  margin-top: 52px;
  border-top: 1px solid #1d1d1d;
}

.preview-header {
  min-height: 92px;
  padding: 24px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid #1d1d1d;
}

.preview-header .eyebrow {
  margin-bottom: 9px;
}

.preview-header h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 400;
  letter-spacing: -.02em;
}

.preview-button,
.preview-action {
  min-height: 38px;
  padding: 0 18px;
  border: 1px solid #333;
  background: transparent;
  color: #aaa;
  cursor: pointer;
  font-size: 12px;
}

.preview-button:hover,
.preview-action:hover {
  border-color: #777;
  color: #fff;
}

.preview-frame {
  margin-top: 24px;
  border: 1px solid #1d1d1d;
  background: #080808;
}

.preview-meta {
  border-bottom: 1px solid #1d1d1d;
}

.preview-meta > div {
  min-height: 48px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  gap: 18px;
  border-bottom: 1px solid #161616;
}

.preview-meta > div:last-child {
  border-bottom: 0;
}

.preview-meta span {
  width: 65px;
  flex-shrink: 0;
  color: #555;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.preview-meta strong {
  min-width: 0;
  color: #aaa;
  font-size: 12px;
  font-weight: 400;
  overflow-wrap: anywhere;
}

.preview-body {
  padding: 34px;
  min-height: 100px;
  background: #fff;
  color: #111;
  font-size: 14px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.preview-body img {
  max-width: 100%;
  height: auto;
}

.preview-body table {
  max-width: 100%;
}

.preview-body a {
  color: inherit;
  text-decoration: underline;
}

.preview-body pre {
  white-space: pre-wrap;
  font-family: Arial, Helvetica, sans-serif;
}


/* STATUS */

.form-status {
  min-height: 24px;
  padding-top: 22px;
  color: #777;
  font-size: 12px;
  line-height: 1.6;
}

.form-status.error {
  color: #d0d0d0;
}

.form-status.success {
  color: #fff;
}


/* ACTIONS */

.form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 22px;
}

.cancel-button {
  min-height: 40px;
  padding: 0 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #666;
  font-size: 12px;
}

.cancel-button:hover {
  color: #fff;
}

.send-button {
  min-height: 40px;
  padding: 0 22px;
  border: 1px solid #fff;
  background: #fff;
  color: #000;
  cursor: pointer;
  font-size: 12px;
}

.send-button:hover {
  background: #ddd;
  border-color: #ddd;
}

.send-button:disabled {
  opacity: .45;
  cursor: wait;
}


/* CONFIRMATION */

.confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, .78);
}

.confirm-dialog {
  width: 100%;
  max-width: 460px;
  padding: 30px;
  border: 1px solid #292929;
  background: #050505;
}

.confirm-dialog h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 400;
  letter-spacing: -.025em;
}

.confirm-dialog p:not(.eyebrow) {
  margin: 14px 0 0;
  color: #777;
  font-size: 13px;
  line-height: 1.7;
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 28px;
}

.confirm-cancel,
.confirm-send {
  min-height: 40px;
  padding: 0 18px;
  cursor: pointer;
  font-size: 12px;
}

.confirm-cancel {
  border: 1px solid #333;
  background: transparent;
  color: #777;
}

.confirm-cancel:hover {
  color: #fff;
  border-color: #777;
}

.confirm-send {
  border: 1px solid #fff;
  background: #fff;
  color: #000;
}

.confirm-send:hover {
  background: #ddd;
}

.confirm-send:disabled {
  opacity: .45;
  cursor: wait;
}


/* UTILITY */

.hidden {
  display: none !important;
}


/* MOBILE DRAWER */

.sidebar-overlay {
  display: none;
}


@media (max-width: 800px) {

  .mobile-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 62px;
    padding: 0 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    background: #000;
    border-bottom: 1px solid #1d1d1d;
    z-index: 110;
  }

  .sidebar {
    width: 250px;
    transform: translateX(-100%);
    transition: transform .2s ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .7);
    z-index: 90;
  }

  .sidebar-overlay.open {
    display: block;
  }

  .main {
    margin-left: 0;
    padding: 90px 20px 70px;
  }

  .page-header {
    padding-bottom: 28px;
  }

  .back-button {
    margin-bottom: 28px;
  }

  .compose-section {
    padding-top: 32px;
  }

  .field-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 13px;
  }

  .body-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .body-mode {
    width: 100%;
  }

  .mode-button {
    flex: 1;
  }

  .preview-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .preview-button {
    width: 100%;
  }

  .preview-body {
    padding: 22px;
  }

  .form-actions {
    flex-wrap: wrap;
    justify-content: stretch;
  }

  .cancel-button,
  .preview-action,
  .send-button {
    flex: 1;
  }

}


@media (max-width: 480px) {

  .main {
    padding-left: 16px;
    padding-right: 16px;
  }

  .page-header h1 {
    font-size: 32px;
  }

  .page-description {
    font-size: 12px;
  }

  .body-editor {
    min-height: 300px;
    padding: 16px;
  }

  .preview-meta > div {
    min-height: 56px;
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    padding-top: 9px;
    padding-bottom: 9px;
  }

  .preview-meta span {
    width: auto;
  }

  .preview-body {
    padding: 18px;
    font-size: 13px;
  }

  .form-actions {
    flex-direction: column-reverse;
  }

  .cancel-button,
  .preview-action,
  .send-button {
    width: 100%;
    flex: none;
  }

  .confirm-dialog {
    padding: 24px;
  }

  .confirm-actions {
    flex-direction: column-reverse;
  }

  .confirm-cancel,
  .confirm-send {
    width: 100%;
  }

}