/* Email Signature Generator (prefix esg-). Left column: grouped form fields; right column: live email-safe
   preview, copy / download buttons and the raw HTML source. Single column under 900px. */
.esg-card { padding: 28px; }
.esg-title-bar { background: linear-gradient(135deg, var(--site-dark) 0%, var(--site-dark-2) 100%); border-radius: 10px 10px 0 0; padding: 18px 24px; margin: -28px -28px 24px; }
.esg-title-bar h1 { color: #fff; margin: 0; font-size: 1.4em; text-align: center; display: flex; align-items: center; justify-content: center; gap: 10px; }

.esg-topline { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 20px; }
.esg-topline p { margin: 0; font-size: .88em; color: #6b7280; }
.esg-topline-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.esg-ghost { font: inherit; font-size: .82em; font-weight: 700; color: var(--site-dark); background: #fff; border: 1px dashed var(--site-dark); border-radius: 8px; padding: 7px 12px; cursor: pointer; transition: background .2s ease, color .2s ease; }
.esg-ghost:hover { background: var(--site-dark); color: #fff; border-style: solid; }

.esg-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 26px; align-items: start; }

.esg-group { margin-bottom: 18px; padding: 14px 16px; background: #f7f8fa; border: 1px solid #eee; border-radius: 10px; }
.esg-group-title { font-size: .76em; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: #6b7280; margin: 0 0 10px; display: flex; align-items: center; gap: 8px; }
.esg-group-title i { color: var(--site-accent); }
.esg-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.esg-field.esg-wide { grid-column: 1 / -1; }
.esg-field label, .esg-field .esg-label { display: block; font-weight: 600; margin-bottom: 6px; font-size: .86em; color: #23272f; }
.esg-field input[type="text"], .esg-field input[type="url"], .esg-field input[type="email"], .esg-field input[type="tel"], .esg-field input[type="number"], .esg-field textarea, .esg-field select { width: 100%; border: 1px solid #ddd; border-radius: 8px; padding: 9px 12px; font: inherit; font-size: .93em; box-sizing: border-box; outline: none; background: #fff; color: #23272f; }
.esg-field textarea { min-height: 72px; resize: vertical; line-height: 1.45; }
.esg-field input:focus, .esg-field textarea:focus, .esg-field select:focus { border-color: var(--site-dark); }
.esg-field small.esg-hint { display: block; color: #6b7280; font-size: .78em; margin-top: 5px; }
.esg-msg { display: none; color: #b91c1c; font-size: .78em; margin-top: 5px; }
.esg-bad .esg-msg { display: block; }
.esg-field.esg-bad input, .esg-field.esg-bad textarea { border-color: #b91c1c; background: #fef2f2; }

.esg-color-row { display: flex; align-items: center; gap: 8px; }
.esg-color-row input[type="color"] { width: 44px; height: 38px; padding: 2px; border: 1px solid #ddd; border-radius: 8px; background: #fff; cursor: pointer; flex: none; }
.esg-color-row input[type="text"] { font-family: "Courier New", monospace; text-transform: lowercase; }

.esg-tpl { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.esg-tpl-btn { border: 1px solid #ddd; background: #fff; border-radius: 8px; padding: 10px 6px; cursor: pointer; font: inherit; font-size: .8em; font-weight: 700; color: #6b7280; display: flex; flex-direction: column; align-items: center; gap: 6px; transition: border-color .2s ease, color .2s ease, background .2s ease; }
.esg-tpl-btn i { font-size: 1.3em; color: #9ca3af; }
.esg-tpl-btn.active { border-color: var(--site-dark); background: var(--site-dark); color: #fff; }
.esg-tpl-btn.active i { color: #fff; }
.esg-tpl-btn:hover:not(.active) { border-color: var(--site-dark); color: var(--site-dark); }

.esg-links { display: flex; flex-direction: column; gap: 8px; }
.esg-link-row { display: grid; grid-template-columns: 26px minmax(0, 1fr) minmax(0, 1.6fr) 32px; gap: 8px; align-items: center; }
.esg-link-row .esg-msg { grid-column: 2 / -1; margin-top: 0; }
.esg-link-ico { color: var(--site-accent); text-align: center; font-size: .95em; }
.esg-link-row input { width: 100%; min-width: 0; border: 1px solid #ddd; border-radius: 8px; padding: 9px 12px; font: inherit; font-size: .93em; box-sizing: border-box; outline: none; background: #fff; color: #23272f; }
.esg-link-row input:focus { border-color: var(--site-dark); }
.esg-link-row.esg-bad .esg-link-url { border-color: #b91c1c; background: #fef2f2; }
.esg-link-del { border: 1px solid #ddd; background: #fff; color: #6b7280; border-radius: 8px; width: 32px; height: 36px; cursor: pointer; font-size: .9em; }
.esg-link-del:hover { color: #b91c1c; border-color: #b91c1c; }
.esg-add-link { margin-top: 10px; font: inherit; font-size: .82em; font-weight: 700; color: var(--site-dark); background: none; border: none; cursor: pointer; padding: 4px 0; display: inline-flex; align-items: center; gap: 6px; }
.esg-add-link:hover { text-decoration: underline; }
.esg-add-link:disabled { color: #9ca3af; cursor: default; text-decoration: none; }

.esg-output { position: sticky; top: 16px; }
.esg-preview-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; font-size: .76em; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: #6b7280; }
.esg-preview-head i { color: var(--site-accent); margin-right: 6px; }
.esg-preview-head span.esg-tpl-name { text-transform: none; letter-spacing: 0; font-weight: 600; color: var(--site-dark); }
.esg-preview { border: 1px solid #e3e6ea; border-radius: 10px; background: #fff; padding: 22px; min-height: 150px; overflow-x: auto; box-shadow: inset 0 1px 3px rgba(0,0,0,.04); }
.esg-preview-empty { color: #9ca3af; font-size: .9em; margin: 0; }

.esg-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.esg-btn { font: inherit; font-size: .86em; font-weight: 700; border-radius: 8px; padding: 10px 16px; cursor: pointer; display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--site-dark); background: var(--site-dark); color: #fff; transition: background .2s ease, color .2s ease, border-color .2s ease; }
.esg-btn:hover { background: var(--site-dark-2); border-color: var(--site-dark-2); }
.esg-btn.esg-secondary { background: #fff; color: var(--site-dark); }
.esg-btn.esg-secondary:hover { background: #f0fdfa; }
.esg-btn.esg-done, .esg-btn.esg-secondary.esg-done { background: #dcfce7; border-color: #86efac; color: #15803d; }
.esg-btn.esg-fail, .esg-btn.esg-secondary.esg-fail { background: #fef2f2; border-color: #fca5a5; color: #b91c1c; }

.esg-status { font-size: .8em; color: #6b7280; margin: 10px 0 0; min-height: 1.2em; }
.esg-status strong { color: #b91c1c; font-weight: 600; }

.esg-source { margin-top: 14px; border: 1px solid #eee; border-radius: 10px; background: #fafbfc; }
.esg-source summary { cursor: pointer; padding: 10px 14px; font-size: .84em; font-weight: 700; color: var(--site-dark); user-select: none; }
.esg-source textarea { width: 100%; min-height: 170px; border: none; border-top: 1px solid #eee; border-radius: 0 0 10px 10px; padding: 12px 14px; font-family: "Courier New", monospace; font-size: .78em; line-height: 1.5; resize: vertical; box-sizing: border-box; outline: none; background: #fafbfc; color: #23272f; white-space: pre; }

@media (max-width: 900px) {
    .esg-layout { grid-template-columns: 1fr; }
    .esg-output { position: static; }
}
@media (max-width: 600px) {
    .esg-card { padding: 18px; }
    .esg-title-bar { margin: -18px -18px 18px; padding: 14px 16px; }
    .esg-title-bar h1 { font-size: 1.15em; }
    .esg-grid { grid-template-columns: 1fr; }
    .esg-link-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr) 32px; }
    .esg-link-ico { display: none; }
    .esg-link-row .esg-msg { grid-column: 1 / -1; }
    .esg-tpl-btn { font-size: .72em; padding: 8px 4px; }
    .esg-buttons .esg-btn { flex: 1 1 100%; justify-content: center; }
    .esg-preview { padding: 14px; }
}
