/* ============================================================
   EMAIL SIGNATURE — workbench layout, soft classic theme, serif headings.
   ============================================================ */
:root {
  --bg: #f4f4f2;
  --surface: #ffffff;
  --surface-2: #ececea;
  --ink: #21242b;
  --muted: #5e6570;
  --subtle: #8b9099;
  --line: #e2e2dd;
  --accent: #41527e;          /* calm ink blue */
  --accent-soft: #ecedf3;
  --danger: #b35140;
  --shadow: 0 12px 32px -20px rgba(40, 45, 55, 0.30);
  --radius: 14px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, ui-serif, serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16171a;
    --surface: #1d1f23;
    --surface-2: #25282e;
    --ink: #e7e8ec;
    --muted: #9aa0aa;
    --subtle: #6f757e;
    --line: #2c2f36;
    --accent: #9aa9d2;
    --accent-soft: #232733;
    --danger: #e08a78;
    --shadow: 0 20px 48px -24px rgba(0, 0, 0, 0.6);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100dvh; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 14px; line-height: 1.6; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }
button, input, select, textarea { font: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.site-header {
  position: sticky; top: 0; z-index: 20; height: 60px;
  display: flex; align-items: center; justify-content: space-between; padding: 0 clamp(18px, 4vw, 44px);
  border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: blur(12px);
}
.logo-link { display: inline-flex; align-items: center; gap: 11px; color: var(--ink); font-weight: 700; font-family: var(--serif); }
.logo-link img { display: block; }
.logo-link small { display: block; font-family: var(--font); font-size: 9.5px; font-weight: 700; color: var(--muted); letter-spacing: 0.12em; text-transform: uppercase; }
.home-link { color: var(--muted); font-size: 13px; font-weight: 650; }
.home-link:hover { color: var(--accent); }

.app-shell { width: min(1480px, 100%); margin: 0 auto; padding: clamp(18px, 3vw, 36px); }

/* Workbench header band */
.workbench-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; padding-bottom: 16px; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.workbench-head h1 { margin-top: 4px; }
.workbench-head .lede { color: var(--muted); max-width: 46ch; margin: 0; font-size: 14px; }

/* Full-width template ribbon */
.ribbon { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); overflow-x: auto; }
.ribbon-label { flex-shrink: 0; font-family: var(--serif); font-style: italic; font-size: 15px; color: var(--accent); padding-right: 12px; border-right: 1px solid var(--line); }
.ribbon .template-cards { display: flex; gap: 10px; }
.ribbon .tpl-card { min-width: 96px; }

.workspace { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(390px, 0.72fr); gap: 20px; align-items: start; }

.tool-panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.controls-panel { padding: clamp(20px, 2.6vw, 30px); }

.eyebrow { margin: 0; color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-family: var(--serif); font-weight: 600; font-size: clamp(28px, 4.4vw, 48px); line-height: 1.04; letter-spacing: -0.01em; }
h2 { margin: 0; font-size: 15px; }

/* Toolbar */
.toolbar { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); margin-bottom: 12px; }
.tb-group { display: flex; gap: 4px; align-items: center; padding-right: 7px; border-right: 1px solid var(--line); }
.tb-group:last-child { border-right: 0; }
.tb-btn { min-width: 34px; height: 34px; border: 1px solid transparent; border-radius: 9px; background: var(--surface); color: var(--ink); font-size: 14px; cursor: pointer; transition: border-color 0.12s, color 0.12s; }
.tb-btn:hover { border-color: var(--accent); color: var(--accent); }
.tb-btn s { text-decoration: line-through; }
.tb-select { height: 34px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--ink); padding: 0 8px; cursor: pointer; max-width: 130px; }
.tb-size { width: 58px; }
.tb-color { position: relative; display: inline-grid; place-items: center; width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); font-weight: 800; cursor: pointer; overflow: hidden; }
.tb-color input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.tb-hl { color: var(--accent); }

/* Editor */
.editor { min-height: 210px; padding: 22px; border: 1px solid var(--line); border-radius: 12px; background: #ffffff; color: #21242b; outline: none; overflow: auto; }
.editor:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent); }
.editor img { max-width: 100%; }
.editor img.img-active { outline: 2px solid var(--accent); outline-offset: 2px; }
.editor table td { min-width: 24px; }
.editor a { color: #41527e; }

/* Template cards */
.block-title { font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); font-weight: 800; margin-bottom: 9px; }
.template-cards { display: grid; grid-template-columns: repeat(5, 1fr); gap: 9px; }
.tpl-card { display: grid; justify-items: center; gap: 8px; padding: 11px 6px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--muted); font-size: 11px; font-weight: 750; cursor: pointer; transition: border-color 0.12s, color 0.12s; }
.tpl-card:hover { border-color: var(--accent); color: var(--accent); }
.tpl-mini { width: 100%; height: 34px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line); position: relative; overflow: hidden; }
.tpl-mini::before, .tpl-mini::after { content: ""; position: absolute; background: var(--subtle); }
.m-classic::before { left: 6px; top: 7px; width: 9px; height: 20px; border-radius: 2px; background: var(--accent); }
.m-classic::after { left: 20px; top: 9px; width: 18px; height: 3px; box-shadow: 0 6px 0 var(--subtle), 0 12px 0 var(--subtle); }
.m-minimal::before { left: 8px; top: 9px; width: 24px; height: 3px; background: var(--ink); }
.m-minimal::after { left: 8px; top: 17px; width: 30px; height: 3px; box-shadow: 0 6px 0 var(--subtle); }
.m-modern::before { left: 6px; top: 6px; width: 4px; height: 22px; border-radius: 2px; background: var(--accent); }
.m-modern::after { left: 16px; top: 8px; width: 22px; height: 3px; box-shadow: 0 6px 0 var(--subtle), 0 12px 0 var(--subtle); }
.m-social::before { left: 7px; top: 9px; width: 14px; height: 14px; border-radius: 50%; background: var(--accent); }
.m-social::after { left: 26px; top: 22px; width: 5px; height: 5px; border-radius: 50%; background: var(--subtle); box-shadow: 7px 0 0 var(--subtle), 14px 0 0 var(--subtle); }
.m-card { border: 1px solid var(--accent); }
.m-card::before { left: 6px; top: 7px; width: 10px; height: 10px; border-radius: 2px; background: var(--accent); }
.m-card::after { left: 20px; top: 8px; width: 16px; height: 3px; box-shadow: 0 14px 0 var(--subtle); }
.m-centered::before { left: 50%; top: 6px; width: 12px; height: 12px; margin-left: -6px; border-radius: 50%; background: var(--accent); }
.m-centered::after { left: 50%; top: 22px; width: 24px; height: 3px; margin-left: -12px; box-shadow: 0 6px 0 var(--subtle); }
.m-corporate::before { left: 6px; top: 7px; width: 9px; height: 20px; border-radius: 2px; background: var(--accent); }
.m-corporate::after { left: 21px; top: 9px; width: 17px; height: 3px; box-shadow: 0 6px 0 var(--subtle), 0 12px 0 var(--subtle); }
.m-promo::before { left: 6px; top: 8px; width: 22px; height: 3px; background: var(--subtle); box-shadow: 0 6px 0 var(--subtle); }
.m-promo::after { left: 6px; top: 21px; width: 18px; height: 8px; border-radius: 3px; background: var(--accent); }
.m-compact::before { left: 6px; top: 15px; width: 32px; height: 4px; border-radius: 2px; background: var(--accent); }
.m-compact::after { display: none; }

/* Blocks */
.blocks-group { margin-top: 14px; }
.seg { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.seg-label { font-size: 12px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: 0.07em; }
.seg-opt { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 650; color: var(--ink); cursor: pointer; }
.seg-opt input { accent-color: var(--accent); }
.block-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.ghost-btn.sm { min-height: 34px; padding: 0 13px; font-weight: 700; border-radius: 9px; }
.social-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }

.insert-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.settings-group { display: grid; gap: 11px; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); align-content: start; }
.settings-group.group-wide { grid-column: 1 / -1; }
.settings-group h2 { font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); font-weight: 800; }

.field { display: grid; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 700; }
.mini-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mini-row:has(> :nth-child(2):last-child) { grid-template-columns: 1fr 1fr; }

input[type="text"], input[type="number"], select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); padding: 10px 11px; outline: none; }
textarea { resize: vertical; font-family: var(--mono); font-size: 12px; min-height: 90px; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent); }
input[type="color"] { width: 100%; height: 34px; padding: 2px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); cursor: pointer; }
input[type="range"] { width: 100%; accent-color: var(--accent); }
.range-value { color: var(--accent); font-family: var(--mono); font-size: 12px; font-weight: 800; }

.file-drop { display: grid; gap: 7px; color: var(--muted); font-size: 12px; font-weight: 700; }
.file-drop input { width: 100%; border: 1px dashed var(--line); border-radius: 10px; padding: 10px; background: var(--surface); color: var(--muted); }
.file-drop span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--subtle); font-family: var(--mono); font-size: 11px; }

.hint { margin: 0; color: var(--subtle); font-size: 11px; }
.hint.center { text-align: center; margin-top: 8px; }
.text-btn { justify-self: start; border: 0; background: transparent; color: var(--accent); padding: 0; font-weight: 750; cursor: pointer; }
.import-wrap { display: grid; gap: 8px; }
.hidden { display: none !important; }

.ghost-btn, .primary-btn { min-height: 44px; border-radius: 11px; border: 1px solid var(--line); font-weight: 800; cursor: pointer; transition: border-color 0.12s, background 0.15s; }
.ghost-btn { background: var(--surface); color: var(--ink); }
.ghost-btn:hover { border-color: var(--accent); color: var(--accent); }
.primary-btn { border-color: var(--accent); background: var(--accent); color: #fff; }
.primary-btn:hover { background: color-mix(in srgb, var(--accent) 88%, #000); }

/* Preview */
.preview-panel { position: sticky; top: 78px; padding: 18px; }
.preview-head { display: flex; align-items: start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.status-pill { display: inline-flex; align-items: center; min-height: 26px; padding: 0 11px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: var(--surface-2); font-size: 12px; font-weight: 760; white-space: nowrap; }

.device-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 5px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 11px; margin-bottom: 12px; }
.tab { border: 0; border-radius: 8px; background: transparent; color: var(--muted); min-height: 34px; padding: 0 10px; font-weight: 750; cursor: pointer; }
.tab.is-active { background: var(--surface); color: var(--accent); }
.zoom-field { margin-bottom: 12px; }

.device { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--surface); box-shadow: var(--shadow); }
.device-bar { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.device-bar .dots { display: inline-flex; gap: 6px; }
.device-bar .dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--line); }
.device-bar .dots i:nth-child(1) { background: var(--accent); }
.device-bar-label { font-family: var(--mono); font-size: 11px; color: var(--subtle); text-transform: lowercase; letter-spacing: 0.04em; }

.device .preview-stage { border: 0; border-radius: 0; }
.preview-stage { padding: 20px; overflow: auto; background: var(--surface-2); }
.preview-scale { transform-origin: top left; transition: transform 0.15s ease; }
.email-frame { background: #ffffff; color: #21242b; border-radius: 6px; box-shadow: 0 6px 24px -12px rgba(30,30,30,0.30); padding: 22px; max-width: 100%; }
.email-frame img { max-width: 100%; }
.email-frame a { color: #41527e; }

.action-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }

/* Info + FAQ */
.info { margin-top: 18px; padding: clamp(20px, 3vw, 30px); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); display: grid; grid-template-columns: 0.85fr 1fr; gap: clamp(18px, 4vw, 40px); align-items: start; }
.info-intro h2 { font-family: var(--serif); font-weight: 600; font-size: clamp(20px, 2.6vw, 30px); margin: 6px 0 8px; }
.info-intro p { color: var(--muted); margin: 0; }
.info-intro p + p { margin-top: 10px; }
.faq { display: grid; gap: 10px; }
details { border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); padding: 0 16px; }
summary { cursor: pointer; font-weight: 750; padding: 13px 0; list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 12px; color: var(--ink); }
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; color: var(--accent); font-weight: 800; font-size: 17px; }
details[open] summary::after { content: "\2013"; }
details > p { margin: 0 0 14px; color: var(--muted); font-size: 13px; line-height: 1.55; }

.site-footer { max-width: 1480px; margin: 0 auto; padding: 24px clamp(18px, 3vw, 36px) 36px; display: flex; gap: 16px; justify-content: space-between; color: var(--subtle); font-size: 12px; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 16px; }

@media (max-width: 1080px) {
  .workspace { grid-template-columns: 1fr; }
  /* Stacked: show the live preview first */
  .preview-panel { position: static; order: -1; }
}
@media (max-width: 720px) {
  .app-shell { padding: 14px; }
  .insert-grid, .social-grid, .info, .mini-row { grid-template-columns: 1fr 1fr; }
  .insert-grid, .social-grid, .info { grid-template-columns: 1fr; }
  .block-btns { display: grid; grid-template-columns: 1fr 1fr; }
  .block-btns .ghost-btn { width: 100%; }
  .site-header { padding: 0 14px; }
  .home-link { display: none; }
  .site-footer { flex-direction: column; }
}
@media (max-width: 420px) {
  .mini-row { grid-template-columns: 1fr; }
}

/* lang-switcher */
.lang-switcher { position: relative; }
.lang-switcher > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-2, transparent); color: var(--muted); font-size: 13px; font-weight: 700; }
.lang-switcher > summary::-webkit-details-marker { display: none; }
.lang-switcher > summary::marker { content: ""; }
.lang-switcher > summary:hover { color: var(--accent); border-color: var(--accent); }
.lang-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 60; display: grid; gap: 2px; max-height: 64vh; overflow: auto; min-width: 190px; padding: 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow, 0 14px 36px rgba(0,0,0,.25)); }
.lang-menu a { padding: 7px 10px; border-radius: 8px; color: var(--ink); font-size: 13px; font-weight: 600; white-space: nowrap; }
.lang-menu a:hover { background: var(--surface-2); color: var(--accent); }
@media (max-width: 720px) { .lang-switcher { display: none; } }
