.composer-layer {
  position: fixed;
  z-index: 300;
  right: 24px;
  bottom: 20px;
  width: min(760px, calc(100vw - 48px));
  height: min(680px, calc(100vh - 40px));
  overflow: hidden;
  border: 1px solid var(--penzo-line-strong);
  border-radius: var(--radius-lg);
  background: var(--penzo-surface);
  box-shadow: var(--shadow-lg);
  transform-origin: bottom right;
}

.composer-layer.minimized {
  width: min(390px, calc(100vw - 30px));
  height: 48px;
}

.composer-frame {
  display: grid;
  height: 100%;
  grid-template-rows: auto auto auto auto minmax(0, 1fr) auto auto;
}

.composer-header {
  display: flex;
  min-height: 46px;
  align-items: center;
  gap: 10px;
  padding: 0 12px 0 15px;
  background: var(--penzo-graphite);
  color: white;
}

.composer-header-copy {
  min-width: 0;
  flex: 1;
}

.composer-header-copy b,
.composer-header-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.composer-header-copy b {
  font-size: 11px;
}

.composer-header-copy small {
  margin-top: 2px;
  color: #bdbdb7;
  font-size: 8px;
}

.composer-header-actions {
  display: flex;
  gap: 4px;
}

.composer-header-actions button {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 7px;
  background: transparent;
  color: white;
  cursor: pointer;
}

.composer-header-actions button:hover {
  background: #4a4a48;
}

.composer-addressing {
  border-bottom: 1px solid var(--penzo-line);
}

.composer-field-row {
  display: flex;
  min-height: 40px;
  align-items: center;
  gap: 8px;
  padding: 0 13px;
  border-bottom: 1px solid #efede7;
}

.composer-field-row:last-child {
  border-bottom: 0;
}

.composer-field-label {
  width: 48px;
  flex: 0 0 auto;
  color: var(--penzo-muted);
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
}

.composer-field-row input,
.composer-field-row select {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 11px;
}

.composer-address-actions {
  display: flex;
  gap: 5px;
}

.composer-address-actions button {
  padding: 4px 5px;
  border-radius: 5px;
  background: transparent;
  color: var(--penzo-muted);
  cursor: pointer;
  font-size: 9px;
  font-weight: 750;
}

.composer-address-actions button:hover {
  background: var(--penzo-surface-2);
  color: var(--penzo-ink);
}

.composer-subject {
  display: flex;
  min-height: 43px;
  align-items: center;
  padding: 0 13px;
  border-top: 1px solid var(--penzo-line);
  border-bottom: 1px solid var(--penzo-line);
}

.composer-subject input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 12px;
  font-weight: 750;
}

.editor-toolbar {
  display: flex;
  min-height: 43px;
  align-items: center;
  gap: 4px;
  padding: 5px 8px;
  overflow-x: auto;
  border-bottom: 1px solid var(--penzo-line);
  background: var(--penzo-surface-2);
}

.toolbar-group {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 3px;
  padding-right: 5px;
  margin-right: 2px;
  border-right: 1px solid var(--penzo-line);
}

.toolbar-group:last-child {
  border-right: 0;
}

.editor-toolbar button,
.editor-toolbar select,
.editor-toolbar input[type="color"] {
  min-height: 29px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  font-size: 10px;
}

.editor-toolbar button {
  min-width: 29px;
  padding: 0 7px;
  font-weight: 750;
}

.editor-toolbar button:hover,
.editor-toolbar select:hover {
  border-color: var(--penzo-line);
  background: white;
}

.editor-toolbar select {
  max-width: 112px;
  padding: 0 24px 0 7px;
}

.editor-toolbar .font-size-select {
  width: 74px;
}

.editor-toolbar input[type="color"] {
  width: 31px;
  padding: 4px;
}

.editor-surface-wrap {
  min-height: 0;
  overflow-y: auto;
  background: white;
}

.editor-surface {
  min-height: 100%;
  padding: 18px 20px 34px;
  outline: 0;
  color: #343434;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 14px;
  line-height: 1.55;
}

.editor-surface:empty::before {
  color: #aaa69c;
  content: attr(data-placeholder);
  pointer-events: none;
}

.editor-surface table {
  width: auto;
  max-width: 100%;
  border-collapse: collapse;
}

.editor-surface td,
.editor-surface th {
  min-width: 78px;
  padding: 6px 8px;
  border: 1px solid #cfcfcf;
}

.editor-surface img {
  max-width: 100%;
  height: auto;
}

.attachment-tray {
  display: flex;
  gap: 7px;
  padding: 0 12px;
  overflow-x: auto;
}

.attachment-tray:not(:empty) {
  padding-top: 8px;
  padding-bottom: 8px;
  border-top: 1px solid var(--penzo-line);
}

.attachment-chip {
  display: flex;
  max-width: 240px;
  flex: 0 0 auto;
  align-items: center;
  gap: 7px;
  padding: 6px 7px 6px 9px;
  border: 1px solid var(--penzo-line);
  border-radius: 8px;
  background: var(--penzo-surface-2);
}

.attachment-chip-copy {
  min-width: 0;
  flex: 1;
}

.attachment-chip-copy b,
.attachment-chip-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-chip-copy b {
  font-size: 9px;
}

.attachment-chip-copy small {
  margin-top: 2px;
  color: var(--penzo-muted);
  font-size: 8px;
}

.attachment-chip button {
  display: grid;
  width: 23px;
  height: 23px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 5px;
  background: transparent;
  color: var(--penzo-muted);
  cursor: pointer;
}

.attachment-chip button:hover {
  background: white;
  color: var(--penzo-danger);
}

.composer-footer {
  display: flex;
  min-height: 54px;
  align-items: center;
  gap: 7px;
  padding: 8px 11px;
  border-top: 1px solid var(--penzo-line);
  background: var(--penzo-surface);
}

.composer-footer-spacer {
  flex: 1;
}

.draft-state {
  margin-left: 3px;
  color: var(--penzo-muted);
  font-size: 8px;
}

.file-input {
  display: none;
}

@media (max-width: 680px) {
  .composer-layer,
  .composer-layer.minimized {
    top: var(--topbar-height);
    right: 0;
    bottom: 0;
    left: 0;
    width: 100vw;
    height: calc(100vh - var(--topbar-height));
    border: 0;
    border-radius: 0;
  }
}

.composer-template-picker {
  display: flex;
  min-height: 38px;
  align-items: center;
  gap: 10px;
  padding: 4px 13px;
  border-bottom: 1px solid var(--penzo-line);
  background: var(--penzo-surface-2);
}

.composer-template-picker span {
  flex: 0 0 65px;
  color: var(--penzo-muted);
  font-size: 9px;
  font-weight: 750;
  text-transform: uppercase;
}

.composer-template-picker select {
  min-width: 180px;
  max-width: 320px;
  min-height: 29px;
  border: 1px solid var(--penzo-line);
  border-radius: 7px;
  background: white;
  color: var(--penzo-ink);
  font-size: 10px;
}

.composer-schedule-panel {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(170px, auto) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-top: 1px solid var(--penzo-line);
  background: #fffbee;
}

.composer-schedule-panel.hidden {
  display: none;
}

.composer-schedule-copy {
  display: grid;
  gap: 2px;
}

.composer-schedule-copy b {
  font-size: 10px;
}

.composer-schedule-copy small,
.composer-schedule-status {
  color: var(--penzo-muted);
  font-size: 8px;
}

.composer-schedule-panel input {
  min-height: 32px;
  padding: 0 8px;
  border: 1px solid var(--penzo-line);
  border-radius: 7px;
  background: white;
  font-size: 10px;
}

.composer-schedule-status {
  grid-column: 1 / -1;
}

@media (max-width: 680px) {
  .composer-schedule-panel {
    grid-template-columns: 1fr;
  }
}
