/* SEPPI · Generador de firmas — estilos de la interfaz (NO afectan la firma) */
:root {
  --red: #CE2023;
  --red-dark: #A3181B;
  --ink: #16181D;
  --text: #2A2E35;
  --muted: #646B76;
  --line: #E4E6EA;
  --bg: #F3F4F6;
  --panel: #FFFFFF;
  --field: #F8F9FA;
  --focus: rgba(206, 32, 35, .16);
  --shadow: 0 1px 2px rgba(16,24,40,.04), 0 8px 24px rgba(16,24,40,.06);
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: Inter, "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 28px;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar__brand { display: flex; align-items: center; gap: 16px; min-width: 0; }
.topbar__logo { height: 30px; width: auto; display: block; }
.topbar__divider { width: 1px; height: 30px; background: var(--line); }
.topbar__title { margin: 0; font-weight: 600; color: var(--ink); font-size: 15px; }
.topbar__sub { margin: 2px 0 0; color: var(--muted); font-size: 12px; }

/* ---------- Layout ---------- */
.layout {
  display: grid;
  grid-template-columns: minmax(340px, 420px) 1fr;
  gap: 24px;
  padding: 24px 28px 48px;
  max-width: 1440px; margin: 0 auto;
  align-items: start;
}
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.panel--form { padding: 18px; position: sticky; top: 84px; max-height: calc(100vh - 108px); overflow: auto; }
.panel--preview { padding: 22px 24px 24px; min-width: 0; }

/* ---------- Segmented (versión) ---------- */
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; background: var(--field); border: 1px solid var(--line); padding: 5px; border-radius: 12px; margin-bottom: 14px; }
.seg__btn {
  border: 0; background: transparent; border-radius: 8px; padding: 9px 10px; cursor: pointer;
  display: flex; flex-direction: column; align-items: flex-start; gap: 1px; font: inherit; color: var(--muted);
  transition: background .15s, color .15s, box-shadow .15s;
}
.seg__btn strong { font-size: 13.5px; font-weight: 600; }
.seg__btn span { font-size: 11px; }
.seg__btn.is-active { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(16,24,40,.12); }
.seg__btn.is-active span { color: var(--red); font-weight: 600; }

/* ---------- Form ---------- */
form { display: flex; flex-direction: column; gap: 12px; }
.group { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px 14px; margin: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.group legend { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 0 6px; }
.group__sub { display: flex; flex-wrap: wrap; gap: 10px; width: 100%; }
.group__sub[hidden] { display: none; }
.group--details { display: block; padding: 0; }
.group--details > summary { cursor: pointer; padding: 13px 14px; font-weight: 600; color: var(--ink); font-size: 13px; list-style: none; display: flex; justify-content: space-between; align-items: center; }
.group--details > summary::-webkit-details-marker { display: none; }
.group--details > summary::after { content: "+"; font-size: 18px; color: var(--muted); }
.group--details[open] > summary::after { content: "–"; }
.group--details[open] { padding-bottom: 14px; }
.group--details > :not(summary) { margin: 0 14px 10px; width: calc(100% - 28px); }

.field { display: flex; flex-direction: column; gap: 5px; flex: 1 1 160px; min-width: 0; }
.field--full { flex-basis: 100%; }
.field--sm { flex: 0 0 96px; }
.field > span { font-size: 12px; font-weight: 600; color: var(--text); }
.field em { color: var(--red); font-style: normal; }
.field small { font-weight: 400; color: var(--muted); font-size: 11px; margin-left: 4px; }
.field input, .field textarea {
  font: inherit; font-size: 13.5px; color: var(--ink);
  background: var(--field); border: 1px solid var(--line); border-radius: 9px;
  padding: 9px 11px; outline: none; width: 100%;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.field textarea { resize: vertical; line-height: 1.45; font-size: 12.5px; }
.field input:focus, .field textarea:focus { border-color: var(--red); background: #fff; box-shadow: 0 0 0 4px var(--focus); }
.field input.is-invalid { border-color: #D97706; }
.hint { display: block; margin: 0 !important; color: var(--muted); font-size: 11px; }
.hint.is-warn { color: #B45309; }

.switch { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 13px; font-weight: 500; color: var(--text); }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch__ui { width: 34px; height: 20px; border-radius: 20px; background: #D5D8DE; position: relative; flex: none; transition: background .15s; }
.switch__ui::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .15s; }
.switch input:checked + .switch__ui { background: var(--red); }
.switch input:checked + .switch__ui::after { transform: translateX(14px); }
.switch input:focus-visible + .switch__ui { box-shadow: 0 0 0 4px var(--focus); }

/* ---------- Buttons ---------- */
.btn {
  font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 14px; border-radius: 9px;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  transition: background .15s, border-color .15s, transform .05s;
  white-space: nowrap;
}
.btn:hover { border-color: #C9CDD4; background: #FAFAFB; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--focus); }
.btn--primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn--primary:hover { background: var(--red-dark); border-color: var(--red-dark); }
.btn--ghost { background: transparent; }
.btn--quiet { border-color: transparent; color: var(--muted); }
.btn[disabled] { opacity: .5; cursor: progress; }

/* ---------- Preview ---------- */
.preview__head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.eyebrow { margin: 0 0 4px; font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--red); }
.preview__title { margin: 0; font-size: 20px; font-weight: 700; color: var(--ink); letter-spacing: -.01em; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; }

.notice { background: #FFF7E6; border: 1px solid #F6D58E; color: #7A4E00; padding: 10px 14px; border-radius: 10px; font-size: 12.5px; margin-bottom: 14px; line-height: 1.5; }

.mail { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; }
.mail__bar { display: flex; gap: 6px; padding: 10px 14px; background: #F7F8FA; border-bottom: 1px solid var(--line); }
.mail__bar span { width: 10px; height: 10px; border-radius: 50%; background: #DADDE2; }
.mail__meta { padding: 12px 22px; border-bottom: 1px solid var(--line); font-size: 12.5px; color: var(--muted); }
.mail__meta p { margin: 2px 0; }
.mail__meta b { color: var(--text); font-weight: 600; }
.mail__body { padding: 22px 22px 28px; overflow-x: auto; }
.mail__text { margin: 0 0 18px; font-family: Arial, Helvetica, sans-serif; font-size: 14px; color: #222; line-height: 1.5; }
.mail__sig-sep { font-family: Arial, sans-serif; color: #999; font-size: 13px; margin-bottom: 14px; }
.sig-host { background: #fff; display: inline-block; min-width: 0; }

.code { margin-top: 16px; border: 1px solid var(--line); border-radius: 10px; }
.code summary { cursor: pointer; padding: 11px 14px; font-weight: 600; font-size: 13px; }
.code pre { margin: 0; padding: 14px; background: #0F1115; color: #D7DAE0; font-size: 11.5px; line-height: 1.5; max-height: 280px; overflow: auto; border-radius: 0 0 10px 10px; white-space: pre-wrap; word-break: break-all; }

/* ---------- Modal ---------- */
.modal { width: min(620px, calc(100vw - 32px)); border: 0; border-radius: 16px; padding: 0; box-shadow: 0 24px 64px rgba(16,24,40,.25); color: var(--text); }
.modal::backdrop { background: rgba(15,17,21,.45); backdrop-filter: blur(2px); }
.modal__head { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px 8px; }
.modal__head h2 { margin: 0; font-size: 18px; color: var(--ink); }
.icon-btn { border: 0; background: var(--field); width: 32px; height: 32px; border-radius: 8px; font-size: 20px; cursor: pointer; color: var(--muted); }
.tabs { display: flex; gap: 4px; padding: 6px 22px 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs__btn { font: inherit; font-size: 13px; font-weight: 600; border: 0; background: none; padding: 10px 12px; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs__btn.is-active { color: var(--red); border-bottom-color: var(--red); }
.tabs__panel { display: none; padding: 14px 22px 4px; font-size: 13.5px; line-height: 1.6; }
.tabs__panel.is-active { display: block; }
.tabs__panel ol { padding-left: 20px; margin: 4px 0; }
.tabs__panel li { margin-bottom: 6px; }
.tip { background: var(--field); border-left: 3px solid var(--red); padding: 10px 12px; border-radius: 6px; font-size: 12.5px; }
kbd { font-family: inherit; font-size: 11px; background: #fff; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 1px 5px; }
.modal__foot { padding: 10px 22px 20px; color: var(--muted); font-size: 12.5px; }

/* ---------- Toast ---------- */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 10px; font-size: 13px; font-weight: 500; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; box-shadow: 0 10px 30px rgba(0,0,0,.2); max-width: calc(100vw - 32px); }
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.toast.is-error { background: #B42318; }

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; padding: 16px; }
  .panel--form { position: static; max-height: none; }
  .topbar { padding: 12px 16px; }
  .topbar__sub, .topbar__divider { display: none; }
}
@media (max-width: 560px) {
  .topbar .btn--ghost { padding: 8px 10px; font-size: 0; gap: 0; }
  .topbar .btn--ghost svg { width: 18px; height: 18px; }
  .panel--preview { padding: 16px; }
  .mail__body { padding: 16px; }
  .toolbar .btn { flex: 1 1 auto; justify-content: center; }
}
