/*
 * EmailSignature: the tool's own components, styled in the site's design language (6 Oct 2026, on the UltraCompress Pro
 * template, after BudgetSnapshot). Base: /libs/site-pages.css (tokens, Inter and Space Grotesk, buttons, theme toggle, focus
 * rings) and /libs/shared-nav.css (the site's header and footer). This file holds only what the tool itself needs: the
 * toolbar with undo and redo, the two-column layout (editor on the left, preview and saved signatures on the right), the
 * collapsible sections, the forms, the image upload boxes (the site's drop-zone look in a small size), the social network
 * grid, the switches, the layout cards, the colour and size controls, the preview card with its tabs, paper and mail-program
 * frames, the saved list, the windows (save, confirm, shortcuts), the toasts and the information sections. Light is the
 * default; dark applies when <html> has no data-theme. The signature itself is always shown on white paper, because that
 * is how an email is read; the mail-program frames keep fixed colours for the same reason.
 */

/* ----- Tokens the tool adds ----- */
:root {
    --surface: #ffffff;                 /* cards are true white in the light theme */
    --surface-2: #f3f4f8;               /* a quiet inset inside a card */
    --ring: rgba(139, 92, 246, 0.18);
    --app-max: 1600px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --paper: #ffffff;
    --paper-text: #1e293b;
}
:root:not([data-theme="light"]) {
    --surface: #14141f;
    --surface-2: rgba(255, 255, 255, 0.05);
}

/* ----- Page: full width, the page provides the side space ----- */
.container.app-container {
    max-width: calc(var(--app-max) + 2 * var(--content-gutter));
    margin-top: 16px;
}
@media (min-width: 640px) { .container.app-container { margin-top: 24px; } }

/* ----- Tools back link above the header, as on every other tool: the bar scrolls away under the sticky header ----- */
body { padding-top: 0; }
.back-bar { height: 48px; display: flex; align-items: center; padding: 0 var(--zdu-gutter, 24px); }
body > header { position: sticky; top: 0; z-index: 50; }
header .site-nav { position: relative; top: auto; }
.theme-toggle { top: calc(90px + var(--bar-offset, 48px)); }
@media (max-width: 768px) { .theme-toggle { top: calc(75px + var(--bar-offset, 48px)); } }

.visually-hidden, .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.hidden-input { display: none; }
.mb-0 { margin-bottom: 0 !important; }
.mt-sm { margin-top: 10px; }

/* ----- Hero: brand row, headline, tagline ----- */
.app-hero { margin: 0 0 2rem; text-align: center; }
.app-brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 1.25rem;
    font-family: 'Space Grotesk', 'Inter', sans-serif;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-strong);
}
.app-brand img { width: 44px; height: 44px; border-radius: 12px; display: block; }
.app-hero h1 { margin-bottom: 0.75rem; }
.app-tagline { color: var(--text-2); font-size: 1.125rem; line-height: 1.6; max-width: 46rem; margin: 0 auto; }

/* ----- Buttons: the site's pills in the tool's sizes ----- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 0;
    border-radius: 9999px;
    font-family: inherit;
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1.2;
    padding: 12px 24px;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; flex-shrink: 0; }
.btn-primary { background: var(--gradient-brand); color: #fff; box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3); }
.btn-primary:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(139, 92, 246, 0.4); color: #fff; }
.btn-secondary { background: var(--surface); color: var(--text-strong); border: 1px solid var(--surface-border); padding: 11px 23px; }
.btn-secondary:hover:not(:disabled) { border-color: var(--brand); color: var(--link); transform: translateY(-2px); }
.btn-danger { background: var(--surface); color: var(--danger); border: 1px solid rgba(185, 28, 28, 0.35); padding: 11px 23px; }
.btn-danger:hover:not(:disabled) { background: var(--danger-strong); color: #fff; border-color: transparent; transform: translateY(-2px); }
.btn-sm { font-size: 0.85rem; padding: 9px 16px; }
.btn-sm svg { width: 15px; height: 15px; }
.btn-secondary.btn-sm, .btn-danger.btn-sm { padding: 8px 15px; }
.btn-icon.btn-sm { width: 38px; height: 38px; padding: 0; }
.btn-icon.btn-sm svg { width: 17px; height: 17px; }

/* ----- The app: the toolbar above the two columns ----- */
.app-shell { margin: 0 0 3rem; scroll-margin-top: 90px; }
.app-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 24px; margin: 0 0 1.25rem; }
.app-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.history-group { display: inline-flex; align-items: center; gap: 8px; }
.toolbar-note { font-size: 0.8rem; color: var(--text-3); margin-left: 6px; }
.toolbar-note:empty { display: none; }

.app-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 20px; align-items: start; }
.editor-column, .preview-column { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.preview-column { position: sticky; top: 92px; }

/* ----- Cards ----- */
.card {
    background: var(--surface);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--surface-shadow);
    overflow: hidden;
}
.card-header { padding: 14px 20px; border-bottom: 1px solid var(--surface-border); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.card-title { margin: 0; font-size: 1.05rem; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.card-note { font-size: 0.8125rem; color: var(--text-3); }
.card-header-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.card-body { padding: 16px 20px 20px; }
.card-body--flush { padding: 0; }
.count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 8px;
    border-radius: 9999px;
    background: var(--tint-brand);
    border: 1px solid var(--tint-brand-border);
    color: var(--link);
    font-size: 0.78rem;
    font-weight: 700;
}

/* ----- Collapsible sections inside the Content and Design cards ----- */
.collapsible { border-bottom: 1px solid var(--surface-border); }
.collapsible:last-child { border-bottom: 0; }
.collapsible-header {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 20px;
    background: none;
    border: 0;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-strong);
    text-align: left;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}
.collapsible-header:hover { background: var(--surface-2); color: var(--link); }
.collapsible-header:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.collapsible-title { display: inline-flex; align-items: center; gap: 10px; }
.collapsible-icon { width: 10px; height: 10px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform 0.25s ease; flex-shrink: 0; margin-right: 4px; }
.collapsible.open .collapsible-icon { transform: rotate(45deg); }
.collapsible-content { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.3s ease; }
.collapsible.open .collapsible-content { grid-template-rows: 1fr; }
.collapsible-content > .collapsible-body { overflow: hidden; min-height: 0; }
.collapsible.open .collapsible-content > .collapsible-body { overflow: visible; }
.collapsible-body { padding: 0 20px 18px; }
.collapsible:not(.open) .collapsible-body { visibility: hidden; }

/* ----- Forms ----- */
.form-group { margin-bottom: 14px; }
.form-group:last-child { margin-bottom: 0; }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-label { display: block; margin-bottom: 6px; font-size: 0.85rem; font-weight: 600; color: var(--text-strong); }
.form-label--sub { margin-top: 10px; }
.label-hint { font-weight: 500; color: var(--text-3); }
.form-input {
    width: 100%;
    min-width: 0;
    padding: 10px 14px;
    background: var(--field);
    border: 1px solid var(--field-border);
    border-radius: 12px;
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--text);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.form-input::placeholder { color: var(--placeholder); }
.form-input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring); }
.form-input.invalid { border-color: var(--danger); }
.form-textarea { resize: vertical; min-height: 2.6em; line-height: 1.5; }
select.form-input { appearance: none; -webkit-appearance: none; padding-right: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 14px; cursor: pointer; }
select.form-input option { color: #0a0a14; background: #fff; }
.form-error { min-height: 0; margin-top: 4px; font-size: 0.8rem; color: var(--danger); }
.form-error:empty { display: none; }
.form-hint { font-size: 0.78rem; color: var(--text-3); margin: 8px 0 0; line-height: 1.5; }

/* Switch rows */
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.toggle {
    position: relative;
    width: 46px;
    height: 26px;
    flex-shrink: 0;
    border-radius: 9999px;
    border: 0;
    padding: 0;
    background: var(--chip-border);
    cursor: pointer;
    transition: background 0.2s ease;
}
.toggle .toggle-knob { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); transition: transform 0.2s ease; }
.toggle[aria-checked="true"] { background: var(--gradient-brand); }
.toggle[aria-checked="true"] .toggle-knob { transform: translateX(20px); }
.toggle:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.toggle-fields { transition: opacity 0.2s ease; }
.toggle-fields.is-off { opacity: 0.5; }

/* Image upload boxes: the site's drop zone, small */
.image-upload { position: relative; }
.image-upload-zone {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 18px 14px;
    background: var(--surface-2);
    border: 2px dashed var(--field-border);
    border-radius: 14px;
    font-family: inherit;
    color: var(--text-2);
    cursor: pointer;
    text-align: center;
    transition: border-color 0.25s ease, background 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
}
.image-upload-zone:hover, .image-upload.is-dragover .image-upload-zone { border-color: var(--brand); background: var(--tint-brand); transform: translateY(-2px); box-shadow: var(--surface-hover-shadow); }
.image-upload-zone:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.image-upload-icon { font-size: 1.6rem; line-height: 1; transition: transform 0.25s ease; }
.image-upload-zone:hover .image-upload-icon, .image-upload.is-dragover .image-upload-icon { transform: scale(1.12); }
.image-upload-text { font-weight: 600; font-size: 0.9rem; color: var(--text-strong); }
.image-upload-hint { font-size: 0.75rem; color: var(--text-3); }
.image-upload-preview { display: none; align-items: center; gap: 14px; padding: 10px 12px; border: 1px solid var(--surface-border); border-radius: 14px; background: var(--surface-2); }
.image-upload.has-image .image-upload-zone { display: none; }
.image-upload.has-image .image-upload-preview { display: flex; }
.image-preview { width: 72px; height: 72px; object-fit: cover; border-radius: 10px; background: #fff; flex-shrink: 0; border: 1px solid var(--surface-border); }
.image-preview--logo { object-fit: contain; padding: 4px; }
.image-preview--banner { width: 160px; height: 40px; object-fit: cover; }
.image-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Social networks */
.social-icons-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; margin: 8px 0 12px; }
.social-icon-btn {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    border: 1px solid var(--chip-border);
    border-radius: 12px;
    background: var(--chip);
    font-family: inherit;
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
.social-icon-btn small { font-size: 0.6rem; font-weight: 600; color: var(--text-3); line-height: 1; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.social-icon-btn:hover { border-color: var(--brand); transform: translateY(-2px); box-shadow: var(--surface-hover-shadow); }
.social-icon-btn[aria-pressed="true"] { background: var(--tint-brand); border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring); }
.social-icon-btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.selected-socials { display: flex; flex-direction: column; gap: 8px; }
.selected-socials:empty { display: none; }
.selected-social-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 8px; }
.selected-social-icon { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border-radius: 10px; background: var(--surface-2); font-size: 1.05rem; }
.selected-social-remove {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--chip-border);
    background: var(--chip);
    color: var(--text-2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.2s ease, color 0.2s ease;
}
.selected-social-remove svg { width: 14px; height: 14px; }
.selected-social-remove:hover { border-color: var(--danger); color: var(--danger); }
.selected-social-item .form-error { grid-column: 2; margin-top: -2px; }

/* Layout cards: four small drawings */
.template-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.template-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px;
    border: 1px solid var(--chip-border);
    border-radius: 12px;
    background: var(--chip);
    font-family: inherit;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
.template-card:hover { border-color: var(--brand); transform: translateY(-2px); box-shadow: var(--surface-hover-shadow); }
.template-card.selected { border-color: var(--brand); background: var(--tint-brand); box-shadow: 0 0 0 3px var(--ring); }
.template-card:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.template-name { font-size: 0.75rem; font-weight: 600; color: var(--text-strong); text-align: center; }
.template-preview { display: flex; align-items: center; gap: 6px; aspect-ratio: 16 / 10; padding: 10px; border-radius: 8px; background: #fff; border: 1px solid rgba(0, 0, 0, 0.06); }
.template-preview i { display: block; width: 22%; aspect-ratio: 1; border-radius: 4px; background: linear-gradient(135deg, #8B5CF6, #EC4899); flex-shrink: 0; }
.template-preview b { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; }
.template-preview u { display: block; height: 4px; border-radius: 2px; background: #cbd5e1; text-decoration: none; }
.template-preview u:first-child { width: 80%; background: #64748b; }
.template-preview u:nth-child(2) { width: 60%; }
.template-preview u:nth-child(3) { width: 90%; }
.template-preview--vertical { flex-direction: column; justify-content: center; }
.template-preview--vertical i { width: 26%; }
.template-preview--vertical b { width: 70%; flex: 0; align-items: center; }
.template-preview--compact i { width: 16%; border-radius: 50%; }
.template-preview--compact u:first-child { width: 95%; }
.template-preview--modern s { display: block; width: 3px; align-self: stretch; border-radius: 2px; background: linear-gradient(180deg, #8B5CF6, #EC4899); }

/* Colours */
.color-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.color-input-wrapper { display: flex; align-items: center; gap: 8px; }
.color-input-wrapper .color-input { width: 44px; } /* the site base's .form-group input { width: 100% } stretched the swatch and pushed the hex field out (8 Oct 2026) */
.color-input { width: 44px; height: 42px; padding: 0; border: 1px solid var(--field-border); border-radius: 12px; background: var(--field); cursor: pointer; flex-shrink: 0; }
.color-input::-webkit-color-swatch-wrapper { padding: 4px; }
.color-input::-webkit-color-swatch { border: 0; border-radius: 8px; }
.color-input::-moz-color-swatch { border: 0; border-radius: 8px; }
.color-hex { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.9rem; text-transform: lowercase; }

/* Sizes: brand sliders whose fill follows the value */
.range-label { display: flex; justify-content: space-between; align-items: center; }
.range-value { font-weight: 600; color: var(--link); font-variant-numeric: tabular-nums; }
.range-input {
    --fill: 50%;
    width: 100%;
    height: 6px;
    margin: 8px 0 4px;
    appearance: none;
    -webkit-appearance: none;
    border-radius: 3px;
    background: linear-gradient(90deg, #8B5CF6 0%, #EC4899 var(--fill), var(--surface-2) var(--fill), var(--surface-2) 100%);
    outline: none;
    cursor: pointer;
}
.range-input::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 20px; height: 20px; border-radius: 50%; background: #fff; border: 2px solid #8B5CF6; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2); cursor: pointer; transition: transform 0.15s ease; }
.range-input::-moz-range-thumb { width: 20px; height: 20px; border-radius: 50%; background: #fff; border: 2px solid #8B5CF6; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2); cursor: pointer; }
.range-input::-webkit-slider-thumb:hover { transform: scale(1.1); }
.range-input:focus-visible { box-shadow: 0 0 0 3px var(--ring); }

/* ----- Preview card ----- */
.preview-card .card-header { gap: 10px 16px; }
.preview-tabs { display: inline-flex; gap: 4px; padding: 4px; border-radius: 9999px; background: var(--surface-2); }
.preview-tab {
    padding: 7px 14px;
    border: 0;
    border-radius: 9999px;
    background: transparent;
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-2);
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}
.preview-tab:hover { color: var(--link); }
.preview-tab.active { background: var(--gradient-brand); color: #fff; box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3); }
.preview-tab:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.preview-area {
    padding: 24px;
    min-height: 260px;
    max-height: 60vh;
    overflow: auto;
    background:
        linear-gradient(135deg, rgba(139, 92, 246, 0.06), rgba(236, 72, 153, 0.06)),
        var(--surface-2);
    display: flex;
    align-items: flex-start;
    justify-content: center;
}
.preview-paper {
    background: var(--paper);
    color: var(--paper-text);
    padding: 28px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(20, 20, 60, 0.12);
    max-width: 100%;
    overflow-x: auto;
}
/* The signature is email markup: undo the base stylesheet's content-table rules (borders, padding, width, underlined links)
   wherever it is shown, so the preview matches what the mail program will render. Inline styles on the cells still win. */
.preview-area #signaturePreview table { width: auto; margin: 0; border: 0; border-radius: 0; box-shadow: none; background: none; font-size: inherit; display: table; }
.preview-area #signaturePreview td, .preview-area #signaturePreview th { border: 0; padding: 0; background: none; text-align: left; color: inherit; font-weight: inherit; }
.preview-area #signaturePreview a { text-decoration: none; }
.preview-area #signaturePreview img { max-width: 100%; }
.preview-paper img { max-width: 100%; }
.preview-paper .sig-placeholder { color: #64748b; font-size: 0.9rem; }
.email-client-frame {
    width: 100%;
    max-width: 640px;
    background: #fff;
    color: #1f2937;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(20, 20, 60, 0.12);
    font-family: Arial, Helvetica, sans-serif;
}
.email-client-header { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid #e5e7eb; background: #f9fafb; font-size: 0.78rem; color: #6b7280; }
.email-client-dots { display: flex; gap: 6px; }
.email-client-dot { width: 11px; height: 11px; border-radius: 50%; }
.email-client-dot.red { background: #ef4444; }
.email-client-dot.yellow { background: #f59e0b; }
.email-client-dot.green { background: #10b981; }
.email-client-title { font-weight: 600; }
.client-gmail .email-client-header { background: #fff; }
.client-outlook .email-client-header { background: #0f6cbd; color: #fff; border-bottom-color: #0f6cbd; }
.client-apple .email-client-header { background: #f3f4f6; }
.email-client-meta { padding: 10px 18px 0; font-size: 0.8rem; color: #6b7280; display: grid; gap: 4px; }
.email-client-meta b { color: #374151; font-weight: 600; }
.email-client-body { padding: 16px 18px 22px; }
.email-mock-content { margin: 0 0 18px; color: #374151; font-size: 14px; line-height: 1.55; }
.email-mock-content p { margin: 0 0 10px; }
.client-gmail .email-mock-content { font-family: Arial, Helvetica, sans-serif; font-size: 13px; }
.client-outlook .email-mock-content { font-family: Calibri, 'Segoe UI', Arial, sans-serif; font-size: 15px; }
.client-apple .email-mock-content { font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 13px; }
.preview-actions { display: flex; flex-wrap: wrap; gap: 10px; padding: 14px 20px 6px; border-top: 1px solid var(--surface-border); }
.preview-actions .btn { flex: 1 1 auto; }
.preview-note { margin: 0; padding: 6px 20px 16px; font-size: 0.8rem; color: var(--text-3); }

/* ----- Saved signatures ----- */
.signature-list { display: flex; flex-direction: column; gap: 8px; }
.signature-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid var(--surface-border);
    border-radius: 12px;
    background: var(--surface);
    transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
.signature-item:hover { border-color: var(--brand); transform: translateY(-2px); box-shadow: var(--surface-hover-shadow); }
.signature-item-swatch { width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 0.9rem; }
.signature-item-info { flex: 1; min-width: 0; }
.signature-item-name { font-weight: 600; color: var(--text-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.signature-item-date { font-size: 0.78rem; color: var(--text-3); }
.signature-item-actions { display: flex; gap: 6px; flex-shrink: 0; }
.signature-item-actions button {
    height: 32px;
    padding: 0 12px;
    border-radius: 9999px;
    border: 1px solid var(--chip-border);
    background: var(--chip);
    color: var(--text-2);
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.2s ease, color 0.2s ease;
}
.signature-item-actions button:hover { border-color: var(--brand); color: var(--link); }
.signature-item-actions button.danger:hover { border-color: var(--danger); color: var(--danger); }
.empty-state { text-align: center; padding: 22px 16px; color: var(--text-3); }
.empty-state-icon { font-size: 2rem; line-height: 1; margin-bottom: 8px; }
.empty-state-text { font-weight: 600; color: var(--text-2); }
.empty-state-subtext { font-size: 0.85rem; margin-top: 4px; }
.saved-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 14px; }
.saved-footer .form-hint { margin: 0; }

/* ----- Windows ----- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 10, 20, 0.6);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}
.modal-overlay.active { opacity: 1; visibility: visible; }
.modal {
    background: var(--surface);
    border: 1px solid var(--surface-border);
    border-radius: 20px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.35);
    width: 100%;
    max-width: 520px;
    max-height: 92vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: translateY(12px);
    transition: transform 0.25s ease;
}
.modal--narrow { max-width: 420px; }
.modal-overlay.active .modal { transform: translateY(0); }
.modal-header { padding: 18px 20px; border-bottom: 1px solid var(--surface-border); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.modal-title { margin: 0; font-size: 1.15rem; }
.modal-close {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    border-radius: 50%;
    border: 1px solid var(--chip-border);
    background: var(--chip);
    color: var(--text-strong);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.2s ease, color 0.2s ease;
}
.modal-close:hover { border-color: var(--brand); color: var(--link); }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--surface-border); display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.modal-hint { margin-top: 14px; }
.confirm-message { margin: 0; color: var(--text); }
.shortcuts-list { display: grid; gap: 10px; }
.shortcut-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.shortcut-keys { display: flex; gap: 4px; }
.shortcut-key {
    background: var(--surface-2);
    border: 1px solid var(--surface-border);
    border-radius: 6px;
    padding: 2px 8px;
    font-size: 0.75rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-weight: 600;
    color: var(--text-2);
}
.shortcut-description { font-size: 0.875rem; color: var(--text-2); }

/* ----- Toasts ----- */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 3000; display: flex; flex-direction: column; gap: 10px; max-width: calc(100vw - 32px); }
.toast {
    background: #0a0a14;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-left: 4px solid var(--brand);
    border-radius: 14px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3);
    min-width: 260px;
    max-width: 400px;
    font-size: 0.875rem;
    font-weight: 500;
    overflow-wrap: anywhere;
    animation: slideIn 0.3s ease;
    transition: opacity 0.3s ease, transform 0.3s ease;
}
.toast-icon { font-size: 1.1rem; line-height: 1; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.toast.success { border-left-color: #4ade80; }
.toast.error { border-left-color: #f87171; }
.toast.warning { border-left-color: #fbbf24; }
.toast.info { border-left-color: #38bdf8; }
.toast.leaving { opacity: 0; transform: translateX(40px); }

/* ----- Information sections below the tool ----- */
.info-section { margin: 0 0 2.5rem; }
.info-section h2 { font-size: 1.75rem; margin: 0 0 1.25rem; }
.info-section > p { max-width: 70ch; }
/* Three columns on desktops, two on tablets, one on phones: six cards fill two rows without a gap. */
.info-section .info-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.info-three { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 1rem 0 1.5rem; }
.info-stack { display: grid; gap: 12px; }
.info-card {
    background: var(--surface);
    border: 1px solid var(--surface-border);
    border-radius: 16px;
    box-shadow: var(--surface-shadow);
    padding: 20px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.info-card:hover { transform: translateY(-4px); box-shadow: var(--surface-hover-shadow); }
.info-card--small { padding: 16px; box-shadow: none; }
.info-card h3 { margin: 0 0 0.75rem; font-size: 1.15rem; }
.info-card p { color: var(--text-2); margin-bottom: 0.75rem; }
.info-card p:last-child { margin-bottom: 0; }
.info-section article:not(.info-card) p { color: var(--text-2); max-width: 70ch; }
.step-card { position: relative; padding-top: 24px; }
.step-num {
    position: absolute;
    top: -16px;
    left: 20px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--gradient-brand);
    color: #fff;
    font-weight: 700;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}
.step-head { display: flex; align-items: center; gap: 12px; margin-bottom: 0.75rem; }
.step-head h3 { margin: 0; }
.step-emoji { font-size: 1.6rem; line-height: 1; }
.info-section details.info-card { padding: 0; }
.info-section details.info-card summary {
    cursor: pointer;
    padding: 16px 20px;
    font-weight: 600;
    color: var(--text-strong);
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}
.info-section details.info-card summary::-webkit-details-marker { display: none; }
.info-section details.info-card summary::after { content: '+'; color: var(--link); font-weight: 700; font-size: 1.2rem; line-height: 1; flex-shrink: 0; }
.info-section details.info-card[open] summary::after { content: '\2212'; }
.info-section details.info-card p { padding: 0 20px 16px; margin: 0; color: var(--text-2); }

/* ----- Tablets ----- */
@media (max-width: 1199px) {
    .social-icons-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 1023px) {
    .app-layout { grid-template-columns: 1fr; }
    .preview-column { position: static; }
    .social-icons-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
    .info-section .info-grid, .info-three { grid-template-columns: repeat(2, 1fr); }
}

/* ----- Phones ----- */
@media (max-width: 639px) {
    .app-hero { margin-bottom: 1.5rem; }
    .app-tagline { font-size: 1rem; }
    .app-toolbar { gap: 10px; }
    .app-actions { width: 100%; }
    .app-actions .btn { flex: 1 1 auto; padding-left: 12px; padding-right: 12px; }
    .card-header { padding-left: 16px; padding-right: 16px; }
    .card-body { padding: 14px 16px 16px; }
    .collapsible-header { padding-left: 16px; padding-right: 16px; }
    .collapsible-body { padding-left: 16px; padding-right: 16px; }
    .form-row, .color-grid { grid-template-columns: 1fr; }
    .social-icons-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .template-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .preview-tabs { width: 100%; overflow-x: auto; }
    .preview-tab { flex: 1; padding-left: 10px; padding-right: 10px; }
    .preview-area { padding: 14px; max-height: none; }
    .preview-paper { padding: 18px; }
    .preview-actions { padding-left: 16px; padding-right: 16px; }
    .preview-note { padding-left: 16px; padding-right: 16px; }
    .signature-item { flex-wrap: wrap; }
    .signature-item-actions { width: 100%; justify-content: flex-end; }
    .modal-overlay { padding: 8px; }
    .modal-body, .modal-header, .modal-footer { padding-left: 16px; padding-right: 16px; }
    .toast-container { bottom: 16px; right: 16px; left: 16px; align-items: flex-end; }
    .toast { min-width: 0; }
    .info-section h2 { font-size: 1.4rem; }
    .info-section .info-grid, .info-three { grid-template-columns: 1fr; }
    .info-card { padding: 16px; }
    .step-num { left: 16px; }
}

@media (prefers-reduced-motion: reduce) {
    .btn, .signature-item, .info-card, .modal, .toast, .collapsible-content, .collapsible-icon, .toggle .toggle-knob, .image-upload-zone, .image-upload-icon, .social-icon-btn, .template-card { transition: none; animation: none; }
}

/* ----- Print: the preview on paper, nothing else ----- */
@media print {
    body { background: #fff !important; color: #000; }
    .back-bar, body > header, .theme-toggle, .app-hero, .app-toolbar, .editor-column, .preview-card .card-header, .preview-actions, .preview-note, .preview-column > .card:not(.preview-card), .info-section, footer, .modal-overlay, .toast-container, #zdu-cookie-banner { display: none !important; }
    .container.app-container { max-width: none; margin: 0; padding: 0; }
    .app-layout { display: block; }
    .preview-column { position: static; }
    .card, .preview-paper, .email-client-frame { box-shadow: none !important; border: 0; }
    .preview-area { background: #fff; padding: 0; max-height: none; justify-content: flex-start; }
}

/* Phones: 16 px text, 44 px tap targets (AdSense audit H-04, 8 Oct 2026) */
@media (max-width: 639.98px) {
    main button, main select, main summary, main [role="button"],
    main input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]) { min-height: 44px; }
    section.card.preview-card > p#previewNote.preview-note { font-size: 1rem; }
    main button#redoBtn, main button#undoBtn { min-width: 44px; }
}
