/* Newsletter tab. nl- classes; tokens come from app/tokens.css. */
#view-newsletter *, #view-newsletter *::before, #view-newsletter *::after {box-sizing: border-box;}
#view-newsletter.active {background: var(--bg); color: var(--text); font-family: var(--font-sans); font-size: 14px; line-height: 1.5; letter-spacing: -0.01em; min-height: calc(100dvh - 56px);}
#view-newsletter [hidden] {display: none !important;}
#view-newsletter p {margin: 0;}
#view-newsletter h2, #view-newsletter h3 {margin: 0; font-weight: 600; letter-spacing: -0.012em; color: var(--text);}
#view-newsletter h2 {font-size: 20px;}
#view-newsletter h3 {font-size: 16px;}
#view-newsletter .nl-app {max-width: 860px; margin: 0 auto; padding: 20px 16px 64px;}
#view-newsletter .nl-muted {color: var(--text2);}
#view-newsletter .nl-dim {color: var(--text3);}
#view-newsletter .nl-mono {font-family: var(--mono); font-size: 12px;}
#view-newsletter .nl-grow {flex: 1;}
#view-newsletter .nl-empty {padding: 32px 0; text-align: center;}
#view-newsletter .nl-notice {padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text2); margin-bottom: 12px;}
#view-newsletter .nl-error {padding: 10px 12px; border: 1px solid var(--danger-border); border-radius: 8px; background: var(--danger-soft); color: var(--red); margin-bottom: 12px;}
#view-newsletter .nl-err-text {color: var(--red); margin: 4px 0 10px;}
#view-newsletter .nl-heading {display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 12px; margin-bottom: 16px;}
#view-newsletter .nl-heading p {margin-top: 4px;}
#view-newsletter .nl-section-title {font-size: 11px; font-weight: 500; letter-spacing: .04em; text-transform: uppercase; color: var(--text3); margin: 24px 0 8px;}

#view-newsletter .nl-btn {display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-size: 14px; border-radius: 6px;
  padding: 7px 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; white-space: nowrap;}
#view-newsletter .nl-btn:hover:not(:disabled) {border-color: var(--border-strong);}
#view-newsletter .nl-btn.nl-primary {background: var(--accent); color: var(--on-accent); border-color: var(--accent); font-weight: 600;}
#view-newsletter .nl-btn.nl-primary:hover:not(:disabled) {background: var(--accent-hover); border-color: var(--accent-hover);}
#view-newsletter .nl-btn.nl-ghost {border-color: transparent; background: none; color: var(--text2);}
#view-newsletter .nl-btn.nl-small {padding: 3px 8px; font-size: 12px;}
#view-newsletter .nl-btn:disabled {opacity: .4; cursor: not-allowed;}
#view-newsletter button:focus-visible, #view-newsletter .nl-input:focus-visible, #view-newsletter summary:focus-visible {outline: 2px solid var(--accent); outline-offset: 2px;}

#view-newsletter .nl-pill {display: inline-flex; align-items: center; gap: 6px; font-size: 12px; padding: 1px 8px; border-radius: 999px; background: var(--surface2); color: var(--text2); white-space: nowrap;}
#view-newsletter .nl-pill::before {content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor;}
#view-newsletter .nl-pill.nl-need {color: var(--orange); background: var(--warning-soft);}
#view-newsletter .nl-pill.nl-run {color: var(--accent); background: var(--accent-light);}
#view-newsletter .nl-pill.nl-done {color: var(--green); background: var(--success-soft);}
#view-newsletter .nl-pill.nl-fail {color: var(--red); background: var(--danger-soft);}

#view-newsletter .nl-card {background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 16px; box-shadow: 0 1px 2px rgb(0 0 0 / .04); margin-bottom: 12px;
  display: flex; flex-direction: column; gap: 10px;}
#view-newsletter .nl-start .nl-btn.nl-primary {align-self: flex-start;}
#view-newsletter .nl-card-head {display: flex; align-items: center; gap: 8px; flex-wrap: wrap;}
#view-newsletter .nl-steer summary {cursor: pointer; color: var(--text2); padding: 2px 0;}
#view-newsletter .nl-steer[open] {display: flex; flex-direction: column; gap: 10px;}

#view-newsletter .nl-field {display: flex; flex-direction: column; gap: 4px; min-width: 0;}
#view-newsletter .nl-label {display: flex; justify-content: space-between; gap: 8px; font-size: 11px; font-weight: 500; letter-spacing: .04em; text-transform: uppercase; color: var(--text3);}
#view-newsletter .nl-count {font-family: var(--mono); letter-spacing: 0; text-transform: none;}
#view-newsletter .nl-count.nl-warn {color: var(--orange);}
#view-newsletter .nl-count.nl-err {color: var(--red); font-weight: 600;}
#view-newsletter .nl-input {width: 100%; font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 7px 10px; resize: vertical;}
#view-newsletter .nl-input:hover {border-color: var(--border-strong);}
#view-newsletter .nl-input[readonly] {background: var(--surface2); color: var(--text2);}
#view-newsletter textarea.nl-input {min-height: 38px; overflow: hidden; line-height: 1.55;}
#view-newsletter .nl-fields {display: flex; flex-direction: column; gap: 10px;}
#view-newsletter .nl-link {align-self: flex-start; color: var(--accent); font-size: 13px; text-decoration: none;}
#view-newsletter .nl-link:hover {text-decoration: underline;}
#view-newsletter .nl-inline {display: flex; gap: 8px; align-items: end; flex-wrap: wrap;}
#view-newsletter .nl-inline > .nl-field, #view-newsletter .nl-inline > .nl-input {flex: 1; min-width: 220px;}
#view-newsletter .nl-rewrite {display: flex; gap: 8px;}

#view-newsletter .nl-options {display: flex; flex-direction: column; gap: 6px; border-top: 1px solid var(--border); padding-top: 10px;}
#view-newsletter .nl-option {display: flex; flex-direction: column; gap: 2px; text-align: left; font: inherit; font-size: 13px; padding: 8px 10px; border: 1px solid var(--border);
  border-radius: 6px; background: var(--bg); color: var(--text); cursor: pointer;}
#view-newsletter .nl-option:hover:not(:disabled) {border-color: var(--accent);}
#view-newsletter .nl-option-title {font-weight: 500;}

#view-newsletter .nl-topics {display: flex; flex-wrap: wrap; gap: 6px;}
#view-newsletter .nl-btn.nl-topic {white-space: normal; text-align: left; background: var(--bg);}
#view-newsletter .nl-btn.nl-topic:hover:not(:disabled) {border-color: var(--accent); color: var(--accent);}
#view-newsletter .nl-top5 {margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 12px;}
#view-newsletter .nl-top5 li {display: flex; flex-direction: column; gap: 6px;}
#view-newsletter .nl-headers {display: flex; flex-wrap: wrap; gap: 6px; align-items: center;}
#view-newsletter .nl-headers .nl-label {width: 100%;}
#view-newsletter .nl-btn.nl-header-opt {white-space: normal; text-align: left;}
#view-newsletter .nl-btn.nl-header-opt.nl-on {border-color: var(--accent); background: var(--accent-light); color: var(--accent);}
#view-newsletter .nl-finish > .nl-btn.nl-primary {align-self: flex-start;}

#view-newsletter .nl-list {display: flex; flex-direction: column;}
#view-newsletter .nl-row {display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px; font: inherit; text-align: left; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px; margin-bottom: 6px; cursor: pointer;}
#view-newsletter .nl-row:hover {border-color: var(--border-strong);}
#view-newsletter .nl-row-text {flex: 1; min-width: 0; display: flex; flex-direction: column;}
#view-newsletter .nl-row-date {font-weight: 600;}
#view-newsletter .nl-row-title {color: var(--text2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;}

#view-newsletter .nl-bar {display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px;}
#view-newsletter .nl-bar-title {font-size: 20px;}
#view-newsletter .nl-tabs {display: inline-flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; background: var(--surface);}
#view-newsletter .nl-tab {font: inherit; font-size: 13px; padding: 6px 12px; border: 0; background: none; color: var(--text2); cursor: pointer;}
#view-newsletter .nl-tab + .nl-tab {border-left: 1px solid var(--border);}
#view-newsletter .nl-tab.nl-on {background: var(--accent-light); color: var(--accent); font-weight: 600;}
#view-newsletter .nl-progress {display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); margin-bottom: 12px;}
#view-newsletter .nl-copyrow {display: flex; align-items: center; gap: 12px; padding: 8px 0; border-top: 1px solid var(--border);}
#view-newsletter .nl-copytext {flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px;}
#view-newsletter .nl-inline > .nl-field.nl-emoji {flex: 0 0 72px; min-width: 72px;}
#view-newsletter .nl-preview {width: 100%; min-height: 80px; border: 1px solid var(--border); border-radius: 6px; background: #EAEAE8;}

@media (max-width: 640px) {
  #view-newsletter .nl-app {padding: 16px 12px 48px;}
  #view-newsletter .nl-tabs {width: 100%;}
  #view-newsletter .nl-tab {flex: 1;}
  #view-newsletter .nl-inline > .nl-field, #view-newsletter .nl-inline > .nl-input {min-width: 100%;}
}
@media (pointer: coarse) {
  #view-newsletter .nl-btn, #view-newsletter .nl-tab {min-height: 40px;}
}

/* Workshop chat: a column beside the sections on wide screens, below them otherwise. */
#view-newsletter .nl-app:has(.nl-workspace:not([hidden])) {max-width: 1260px;}
#view-newsletter .nl-workspace {display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 12px; align-items: start;}
#view-newsletter .nl-review {min-width: 0;}
#view-newsletter .nl-chat {position: sticky; top: 12px; display: flex; flex-direction: column; gap: 8px; max-height: calc(100dvh - 120px);
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 14px; box-shadow: 0 1px 2px rgb(0 0 0 / .04);}
#view-newsletter .nl-chat-head {display: flex; align-items: center; gap: 8px;}
#view-newsletter .nl-chat-hint {font-size: 12px;}
#view-newsletter .nl-chat-log {flex: 1; min-height: 120px; overflow: auto; display: flex; flex-direction: column; gap: 8px; padding-right: 2px;}
#view-newsletter .nl-chat-empty {font-size: 13px; padding: 12px 0;}
#view-newsletter .nl-msg {max-width: 92%; border-radius: 8px; padding: 8px 10px; font-size: 13px; line-height: 1.5;}
#view-newsletter .nl-msg-text {white-space: pre-wrap; overflow-wrap: anywhere;}
#view-newsletter .nl-msg-user {align-self: flex-end; background: var(--accent-light); color: var(--text);}
#view-newsletter .nl-msg-ai {align-self: flex-start; background: var(--surface2); color: var(--text);}
#view-newsletter .nl-proposal {margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; align-items: flex-start;}
#view-newsletter .nl-proposal ul {margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px;}
#view-newsletter .nl-proposal-detail {display: block; white-space: pre-wrap; color: var(--text2); font-size: 12px; max-height: 9em; overflow: auto;}
#view-newsletter .nl-chat-status {font-size: 12px; color: var(--text2); min-height: 0;}
#view-newsletter .nl-chat-status:empty {display: none;}
#view-newsletter .nl-chat-form {display: flex; flex-direction: column; gap: 6px; align-items: flex-end;}
#view-newsletter .nl-chat-form .nl-input {resize: vertical; min-height: 64px;}
#view-newsletter .nl-btn.nl-ghost.nl-small[hidden] {display: none;}
@media (max-width: 1100px) {
  #view-newsletter .nl-workspace {grid-template-columns: minmax(0, 1fr);}
  #view-newsletter .nl-chat {position: static; max-height: none;}
  #view-newsletter .nl-chat-log {max-height: 420px;}
}
