/* Layout: settings column on the left, sticky live signature on the right; stacks on phones */
:root {
    --bg: #edf3f7;
    --panel: #ffffff;
    --fg: #183042;
    --muted: #526979;
    --line: #d5e1e8;
    --ui-accent: #087e83;
    --ui-soft: #e0f3f1;
    --ui-ink: #ffffff;
    --input-bg: #f7fafc;
    --page-glow: rgba(54, 169, 170, .10);
    --accent: #f15a29;
    --accent-ink: #ffffff;
    --accent-soft: #fde8df;
    --stage: #e4edf3;
    --shadow: rgba(17, 48, 69, .12);
    --display: "Figtree", system-ui, sans-serif;
    --body: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #0d1925;
        --panel: #152636;
        --fg: #e7f0f6;
        --muted: #a2b7c7;
        --line: #2c4254;
        --accent: #ff6a38;
        --accent-ink: #1a0d07;
        --accent-soft: #3a2219;
        --stage: #1b3143;
        --shadow: rgba(0, 0, 0, .45);
        --ui-accent: #6ad9cf;
        --ui-soft: #193b41;
    --ui-ink: #0d2931;
    --input-bg: #102131;
    --page-glow: rgba(54, 169, 170, .08);
        color-scheme: dark
    }
}

:root[data-theme="dark"] {
    --bg: #0d1925;
    --panel: #152636;
    --fg: #e7f0f6;
    --muted: #a2b7c7;
    --line: #2c4254;
    --accent: #ff6a38;
    --accent-ink: #1a0d07;
    --accent-soft: #3a2219;
    --stage: #1b3143;
    --shadow: rgba(0, 0, 0, .45);
    --ui-accent: #6ad9cf;
    --ui-soft: #193b41;
    --ui-ink: #0d2931;
    --input-bg: #102131;
    --page-glow: rgba(54, 169, 170, .08);
    color-scheme: dark
}

* {
    box-sizing: border-box
}

body {
    background: radial-gradient(ellipse at 85% 0%, var(--page-glow), transparent 55%), var(--bg);
    color: var(--fg);
    font-family: var(--body);
    font-size: 15px;
    line-height: 1.5
}

.wrap {
    max-width: 1320px;
    margin: 0 auto;
    padding-block: 48px 24px;
    padding-inline: 32px
}

header {
    margin-bottom: 32px
}

h1 {
    font-family: var(--display);
    font-weight: 700;
    font-size: clamp(34px, 4vw, 52px);
    line-height: 1.12;
    margin: 0;
    letter-spacing: -.045em;
    text-wrap: balance
}

h1 span {
    color: var(--ui-accent)
}

.sub {
    color: var(--muted);
    margin: 16px 0 0;
    max-width: 58ch;
    font-size: 16px;
    line-height: 1.65
}

.grid {
    display: grid;
    grid-template-columns: minmax(0, 440px) minmax(0, 1fr);
    gap: 28px;
    align-items: start
}

@media (max-width:900px) {
    .grid {
        grid-template-columns: 1fr
    }
}

.col {
    display: grid;
    gap: 16px;
    min-width: 0
}

.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 2px 4px rgba(20, 30, 50, .02)
}

.label {
    font-family: var(--display);
    font-size: 17px;
    letter-spacing: -.02em;
    color: var(--fg);
    margin: 0 0 6px;
    font-weight: 700
}

.note {
    font-size: 13px;
    color: var(--muted);
    margin: 0 0 20px;
    line-height: 1.6
}

.fields {
    display: grid;
    gap: 16px
}

.field {
    display: grid;
    gap: 7px;
    min-width: 0
}

.field>label,
.lbl {
    font-size: 13px;
    font-weight: 600
}

input[type=text],
input[type=search],
select,
input[type=email],
input[type=url],
input[type=tel] {
    font: inherit;
    color: var(--fg);
    background: var(--input-bg);
    border: 1px solid var(--line);
    border-radius: 9px;
    padding: 11px 12px;
    min-height: 46px;
    width: 100%;
    min-width: 0
}

input:focus,
select:focus {
    outline: 2px solid var(--ui-accent);
    outline-offset: 1px;
    border-color: transparent
}

.iconrow {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 8px;
    align-items: center
}

.pickbtn {
    width: 46px;
    height: 46px;
    border-radius: 10px;
    border: 1px dashed var(--line);
    background: var(--input-bg);
    display: grid;
    place-items: center;
    cursor: pointer;
    padding: 0;
    position: relative
}

.pickbtn img {
    width: 24px;
    height: 24px;
    display: block
}

.pickbtn:hover {
    border-color: var(--ui-accent);
    border-style: solid
}

.pickbtn::after {
    content: "";
    position: absolute;
    right: 3px;
    bottom: 3px;
    border: 3px solid transparent;
    border-top-color: var(--muted);
    transform: translateY(2px)
}

.pickbtn:focus-visible {
    outline: 2px solid var(--ui-accent);
    outline-offset: 2px
}

.social .iconrow img.badge {
    width: 26px;
    height: 26px;
    margin: 0 7px
}

.style-grid {
    display: grid;
    gap: 14px
}

.seg {
    display: flex;
    flex-wrap: wrap;
    gap: 8px
}

.seg button {
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    padding: 7px 13px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--input-bg);
    color: var(--fg);
    cursor: pointer
}

.seg button[aria-pressed="true"] {
    background: var(--ui-accent);
    border-color: var(--ui-accent);
    color: var(--ui-ink)
}

.colors {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center
}

.sw {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid var(--panel);
    box-shadow: 0 0 0 1px var(--line);
    cursor: pointer;
    padding: 0
}

.sw[aria-pressed="true"] {
    box-shadow: 0 0 0 2px var(--fg)
}

.swl {
    display: contents
}

.cos {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px
}

.co {
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 14px 6px 10px;
    cursor: pointer;
    display: grid;
    gap: 4px;
    justify-items: center;
    min-width: 0;
    font: inherit
}

.co img {
    height: 40px;
    width: auto;
    max-width: 100%;
    object-fit: contain;
    display: block
}

.co span {
    font-size: 11.5px;
    font-weight: 600;
    color: #55504c
}

.co[aria-checked="true"] {
    border-color: var(--ui-accent);
    box-shadow: 0 0 0 1px var(--ui-accent)
}

.co:focus-visible {
    outline: 2px solid var(--fg);
    outline-offset: 2px
}

.seg-like {
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    padding: 5px 12px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--input-bg);
    color: var(--fg);
    cursor: pointer
}

.seg-like[aria-pressed="true"] {
    background: var(--ui-accent);
    border-color: var(--ui-accent);
    color: var(--ui-ink)
}

.colors input[type=color] {
    width: 44px;
    height: 44px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--input-bg);
    padding: 2px;
    cursor: pointer
}

details summary {
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    color: var(--fg);
    min-height: 44px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    list-style: none
}

details[open] summary {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--line)
}

.hint {
    font-size: 12px;
    color: var(--muted)
}

.check {
    display: flex;
    gap: 8px;
    align-items: center;
    font-size: 13px;
    font-weight: 600
}

.stage {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 28px;
    display: grid;
    gap: 0;
    min-width: 0;
    position: sticky;
    top: calc(env(safe-area-inset-top, 0px) + 16px)
}

@media (max-width:900px) {
    .stage {
        position: static
    }
}

.stagehead {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap
}

.paper {
    background: #ffffff;
    color: #1b1817;
    border-radius: 0 0 12px 12px;
    padding: 32px 24px;
    overflow-x: auto;
    min-height: 200px
}

.actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 24px
}

.btn {
    font: inherit;
    font-weight: 600;
    border-radius: 10px;
    padding: 11px 20px;
    cursor: pointer;
    border: 1px solid transparent
}

.btn:active {
    transform: translateY(1px)
}

.btn:focus-visible {
    outline: 2px solid var(--fg);
    outline-offset: 2px
}

.primary {
    background: var(--ui-accent);
    color: var(--ui-ink);
    flex: 1
}

.ghost {
    background: transparent;
    color: var(--fg);
    border-color: var(--line)
}

.ghost:hover {
    background: var(--panel)
}

.toast {
    font-size: 13px;
    font-weight: 600;
    color: var(--ui-accent);
    min-height: 24px;
    margin-top: 10px
}

.steps {
    display: grid;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
    counter-reset: s
}

.steps li {
    display: grid;
    grid-template-columns: 24px 1fr;
    gap: 10px;
    font-size: 13px;
    color: var(--muted)
}

.steps li::before {
    counter-increment: s;
    content: counter(s);
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--ui-soft);
    color: var(--ui-accent);
    font-weight: 700;
    font-size: 12px;
    display: grid;
    place-items: center
}

.steps b {
    color: var(--fg);
    font-weight: 600
}

/* icon picker popover */
.pop {
    position: absolute;
    z-index: 20;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 12px 32px var(--shadow);
    width: min(296px, calc(100vw - 32px))
}

.pop p {
    margin: 0 0 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--muted)
}

.pop .icons {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 6px
}

.pop .icons button {
    aspect-ratio: 1;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--input-bg);
    display: grid;
    place-items: center;
    cursor: pointer;
    padding: 0;
    max-width: 100%
}

.pop .icons button[aria-pressed="true"] {
    border-color: var(--ui-accent);
    box-shadow: 0 0 0 1px var(--ui-accent)
}

.pop .icons img {
    width: 24px;
    height: 24px
}

.pop .row {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    flex-wrap: wrap
}

.pop .row button,
.pop .row label {
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    padding: 7px 12px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--input-bg);
    color: var(--fg);
    cursor: pointer
}

.pop .row label:focus-within {
    outline: 2px solid var(--ui-accent)
}

.vh {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap
}

textarea.tmp {
    position: fixed;
    left: -9999px;
    top: 0
}

/* Editor navigation and progressive disclosure */
.title-picker { position: relative; min-width: 0; }
.title-select {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    min-height: 46px;
    padding: 11px 12px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--input-bg);
    color: var(--fg);
    font: inherit;
    text-align: left;
}
.title-select:hover, .title-select[aria-expanded="true"] { border-color: var(--ui-accent); }
.select-chevron { width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); flex-shrink: 0; margin: 0 3px 4px; }
.title-select[aria-expanded="true"] .select-chevron { transform: rotate(225deg); margin-bottom: 0; }
.title-menu { position: absolute; z-index: 15; top: calc(100% + 6px); left: 0; right: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 32px var(--shadow); overflow: hidden; }
.title-search-wrap { padding: 10px; }
#titleOptions { max-height: 220px; overflow-y: auto; overscroll-behavior: contain; padding: 0 5px 5px; }
#titleOptions [role="option"] { padding: 11px 10px; min-height: 44px; border-radius: 6px; cursor: pointer; font-size: 14px; overflow-wrap: anywhere; }
#titleOptions [role="option"].active, #titleOptions [role="option"]:hover { background: var(--ui-soft); color: var(--ui-accent); }
#titleOptions [aria-selected="true"] { font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.title-empty { padding: 0 14px; color: var(--muted); font-size: 12px; margin: 0 0 10px; }

.eyebrow {
    color: var(--ui-accent);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .16em;
    margin: 0 0 16px;
}

.workflow {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 24px;
    margin-top: 26px;
}

.workflow a {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    min-height: 44px;
    color: var(--fg);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
}

.workflow a span {
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: var(--panel);
    color: var(--muted);
    font-size: 12px;
}

.workflow a:hover, details summary:hover { color: var(--ui-accent); }
section[id] { scroll-margin-top: 24px; }
details summary::-webkit-details-marker { display: none; }
details summary::after {
    content: "";
    width: 8px;
    height: 8px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    flex-shrink: 0;
    margin-right: 4px;
    transition: transform .2s;
}
details[open] summary::after { transform: rotate(225deg); }
details summary small {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 400;
    margin-top: 3px;
}

.stagehead .label { margin: 0; font-size: 20px; }
.preview-note { color: var(--muted); font-size: 13px; margin: 6px 0 24px; }
.live-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}
.live-badge span { width: 6px; height: 6px; border-radius: 50%; background: #32845e; }
.preview-canvas {
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(20, 30, 50, .04);
}
.paper > table { min-width: 520px; }
.preview-scroll-hint { display: none; color: var(--muted); font-size: 12px; margin: 10px 0 0; }
@media (max-width: 1100px) and (min-width: 901px), (max-width: 650px) {
    .preview-scroll-hint { display: block; }
}
.email-heading {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 18px;
    background: var(--stage);
    color: var(--muted);
    border-bottom: 1px solid var(--line);
    border-radius: 12px 12px 0 0;
    font-size: 12px;
}
.install-guide { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 20px; }
.install-guide h3 { font-size: 13px; font-weight: 700; margin: 0 0 16px; }
.page-footer { text-align: center; font-size: 12px; color: var(--muted); margin-top: 40px; }

button, select, input[type=color] { cursor: pointer; }
button, input, select, summary, a { -webkit-tap-highlight-color: transparent; }
button, input, select { transition: border-color .18s, background-color .18s, box-shadow .18s; }
button:focus-visible, a:focus-visible, summary:focus-visible, .paper:focus-visible {
    outline: 2px solid var(--ui-accent);
    outline-offset: 4px;
}
.seg button, .seg-like, .btn { min-height: 44px; }
.seg button:hover, .seg-like:hover { border-color: var(--fg); }
.primary:hover { box-shadow: 0 0 0 3px var(--line); }
.co:hover { border-color: var(--ui-accent); }
.co[aria-checked="true"] span { text-decoration: underline; text-underline-offset: 4px; }
.check { min-height: 44px; cursor: pointer; }
.check input { width: 18px; height: 18px; flex-shrink: 0; accent-color: var(--ui-accent); }
.pop .icons button { min-height: 44px; }
.pop .icons { grid-template-columns: repeat(5, 1fr); }
.skip-link { position: fixed; top: -100px; left: 16px; padding: 12px 18px; z-index: 100; background: var(--panel); color: var(--fg); border-radius: 8px; }
.skip-link:focus { top: 16px; }

@media (max-width: 1100px) and (min-width: 901px) {
    .grid { grid-template-columns: minmax(0, 360px) minmax(0, 1fr); gap: 20px; }
    .stage { padding: 20px; }
}
@media (max-width: 600px) {
    .wrap { padding: 28px 16px 20px; }
    .panel { padding: 20px; }
    .stage { padding: 20px 16px; }
    .workflow { gap: 4px 16px; }
    .workflow a { font-size: 12px; }
    input[type=text], input[type=search], input[type=email], input[type=url], input[type=tel], select { font-size: 16px; }
    .actions .primary { flex-basis: 100%; }
    .actions .ghost { flex: 1; }
    .paper { padding: 24px 16px; }
    .stagehead .label { font-size: 18px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}
