:root {
  --purple: #6429cd;
  --violet: #531dbc;
  --midnight: #330072;
  --lavender: #e4a4ff;
  --bright: #9610ff;

  --bg: #f6f4fb;
  --surface: #ffffff;
  --surface-2: #f3effb;
  --text: #1d1d1b;
  --muted: #6b6680;
  --border: #e3ddf0;
  --focus: rgba(100, 41, 205, 0.18);
  --accent-text: #6429cd;
  --danger: #c62828;
  --danger-bg: #fdecec;
  --ok: #1b8a5a;
  --warn-bg: #fff6e5;
  --warn: #8a5a00;
  --shadow: 0 1px 2px rgba(51, 0, 114, 0.06), 0 12px 40px rgba(51, 0, 114, 0.10);

  --font: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f0b1a;
    --surface: #1a1428;
    --surface-2: #231b36;
    --text: #f1edfa;
    --muted: #a59fbd;
    --border: #2f2645;
    --focus: rgba(228, 164, 255, 0.22);
    --accent-text: #e4a4ff;
    --danger: #ff8a80;
    --danger-bg: #3a1618;
    --ok: #2fa874;
    --warn-bg: #33260b;
    --warn: #ffd27a;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 16px 48px rgba(0, 0, 0, 0.45);
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
}

/* ---------- Layout ---------- */
.shell { min-height: 100vh; display: grid; grid-template-columns: minmax(340px, 5fr) 7fr; }

.brand {
  position: relative;
  overflow: hidden;
  padding: 48px 56px;
  display: flex;
  flex-direction: column;
  color: #fff;
  background:
    radial-gradient(900px 500px at 110% -10%, rgba(150, 16, 255, 0.55), transparent 60%),
    radial-gradient(700px 500px at -20% 110%, rgba(221, 82, 221, 0.35), transparent 60%),
    linear-gradient(160deg, var(--midnight) 0%, #22004d 100%);
}
.brand::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.07) 1px, transparent 1px);
  background-size: 22px 22px;
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 40%, #000 70%, transparent);
  mask-image: linear-gradient(180deg, transparent, #000 40%, #000 70%, transparent);
  pointer-events: none;
}
.brand > * { position: relative; z-index: 1; }

.wordmark { display: inline-flex; align-items: center; gap: 4px; color: #fff; text-decoration: none; }
.wordmark img { display: block; height: 34px; width: auto; }
.wordmark small {
  display: inline-block;
  margin-left: 10px;
  padding: 2px 10px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  vertical-align: middle;
  color: rgba(255, 255, 255, 0.85);
}

.brand-body { margin: auto 0; padding: 48px 0; max-width: 440px; }
.brand h1 { margin: 0 0 16px; font-size: clamp(30px, 3.2vw, 42px); line-height: 1.15; font-weight: 700; letter-spacing: -0.8px; }
.brand h1 em { font-style: normal; color: var(--lavender); }
.brand p.lead { margin: 0 0 36px; color: rgba(255, 255, 255, 0.78); font-size: 16px; }

.features { list-style: none; margin: 0; padding: 0; display: grid; gap: 20px; }
.features li { display: grid; grid-template-columns: 44px 1fr; gap: 14px; align-items: start; }
.features strong { display: block; font-weight: 600; font-size: 15px; }
.features span { color: rgba(255, 255, 255, 0.7); font-size: 14px; }

.icon-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 1.5px solid rgba(228, 164, 255, 0.5);
  background: rgba(255, 255, 255, 0.06);
  color: var(--lavender);
}
.icon-circle svg { width: 20px; height: 20px; }

.tagline { margin: 0; font-weight: 300; font-size: 13px; color: rgba(255, 255, 255, 0.6); letter-spacing: 0.4px; }

.content { display: flex; align-items: center; justify-content: center; padding: 48px 32px; }
.panel { width: 100%; max-width: 560px; }

.panel-head { margin-bottom: 24px; }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; color: var(--accent-text); }
.panel-head h2 { margin: 6px 0; font-size: 26px; font-weight: 700; letter-spacing: -0.4px; line-height: 1.25; }
.panel-head p { margin: 0; color: var(--muted); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 28px; box-shadow: var(--shadow); }

/* ---------- Form ---------- */
.field { margin-bottom: 22px; }

label, .label { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 8px; font-weight: 600; font-size: 14px; }
.hint { font-weight: 400; font-size: 12px; color: var(--muted); }
.help { margin: 8px 0 0; font-size: 12.5px; color: var(--muted); }

input[type="text"], input[type="password"], input[type="email"], textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
textarea { font-family: var(--mono); font-size: 14px; resize: vertical; min-height: 130px; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 0.75; }
input:focus, textarea:focus, .chips:focus-within { outline: none; border-color: var(--purple); box-shadow: 0 0 0 4px var(--focus); }

.counter { font-weight: 400; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* Chips de destinatarios */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 7px;
  min-height: 50px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  cursor: text;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.chips.invalid { border-color: var(--danger); }
.chips input { flex: 1; min-width: 200px; border: 0 !important; box-shadow: none !important; padding: 6px; background: transparent; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 4px 4px 12px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 500;
}
.chip button { width: 24px; height: 24px; border: 0; border-radius: 50%; display: grid; place-items: center; background: transparent; color: var(--muted); cursor: pointer; padding: 0; }
.chip button:hover { background: var(--border); color: var(--text); }
.chip button svg { width: 14px; height: 14px; }

/* Selector segmentado */
.segmented { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label { margin: 0; justify-content: center; padding: 9px 8px; border-radius: 9px; font-weight: 500; color: var(--muted); cursor: pointer; transition: background 0.15s, color 0.15s; }
.segmented input:checked + label { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: 0 1px 3px rgba(51, 0, 114, 0.15); }
.segmented input:focus-visible + label { box-shadow: 0 0 0 3px var(--focus); }

/* Opcional plegable */
details.optional { border: 1px dashed var(--border); border-radius: 12px; padding: 12px 14px; }
details.optional summary { cursor: pointer; font-weight: 600; font-size: 14px; list-style: none; display: flex; align-items: center; gap: 8px; }
details.optional summary::-webkit-details-marker { display: none; }
details.optional summary svg { width: 16px; height: 16px; color: var(--accent-text); transition: transform 0.2s; }
details.optional[open] summary svg { transform: rotate(90deg); }
details.optional .inner { padding-top: 12px; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 13px 22px;
  border: 0;
  border-radius: 12px;
  font: 600 15px/1 var(--font);
  cursor: pointer;
  transition: transform 0.08s, background 0.15s, box-shadow 0.15s, border-color 0.15s;
  text-decoration: none;
}
.btn svg { width: 18px; height: 18px; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--focus); }
.btn:disabled { opacity: 0.65; cursor: progress; }

.btn-primary { width: 100%; margin-top: 26px; color: #fff; background: linear-gradient(135deg, var(--purple), var(--violet)); box-shadow: 0 8px 20px rgba(100, 41, 205, 0.28); }
.btn-primary:hover { background: linear-gradient(135deg, #7133e0, var(--purple)); }
.btn-ghost { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { border-color: var(--purple); }
.btn-copy { background: var(--purple); color: #fff; }
.btn-copy.done { background: var(--ok); }
.btn-link { background: none; border: 0; padding: 0; font: 500 13px var(--font); color: var(--muted); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.4); border-top-color: #fff; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Mensajes ---------- */
.alert { display: flex; gap: 10px; align-items: flex-start; margin-top: 18px; padding: 12px 14px; border-radius: 12px; font-size: 14px; }
.alert svg { flex: none; width: 18px; height: 18px; margin-top: 2px; }
.alert-error { background: var(--danger-bg); color: var(--danger); }
.alert-warn { background: var(--warn-bg); color: var(--warn); }

/* ---------- Resultado ---------- */
.success-icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  margin-bottom: 18px;
  color: #fff;
  background: linear-gradient(135deg, var(--purple), var(--bright));
  box-shadow: 0 10px 24px rgba(100, 41, 205, 0.35);
}
.success-icon svg { width: 28px; height: 28px; }

.linkbox { display: flex; gap: 8px; padding: 6px; border: 1.5px solid var(--border); border-radius: 14px; background: var(--surface-2); }
.linkbox input { flex: 1; min-width: 0; border: 0 !important; box-shadow: none !important; background: transparent; font-family: var(--mono); font-size: 13px; }
.linkbox .btn { padding: 10px 16px; font-size: 14px; }

.meta { list-style: none; margin: 20px 0 0; padding: 0; display: grid; gap: 10px; font-size: 14px; color: var(--muted); }
.meta li { display: flex; gap: 10px; align-items: flex-start; }
.meta svg { width: 16px; height: 16px; margin-top: 3px; color: var(--accent-text); flex: none; }
.meta strong { color: var(--text); font-weight: 600; word-break: break-word; }

.mt-12 { margin-top: 12px; }
.actions { display: flex; gap: 10px; margin-top: 24px; flex-wrap: wrap; }

/* ---------- Vista del secreto ---------- */
.topbar { display: flex; justify-content: flex-end; align-items: center; gap: 12px; margin-bottom: 20px; min-height: 38px; }
.user-pill { display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px 5px 5px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); font-size: 13px; font-weight: 500; }
.avatar { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; color: #fff; background: linear-gradient(135deg, var(--purple), var(--bright)); }

.center-state { text-align: center; padding: 8px 4px; }
.big-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 18px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  color: var(--accent-text);
  border: 1.5px solid var(--border);
}
.big-icon svg { width: 32px; height: 32px; }
.big-icon.danger { color: var(--danger); background: var(--danger-bg); border-color: transparent; }
.center-state h3 { margin: 0 0 6px; font-size: 19px; font-weight: 700; }
.center-state p { margin: 0 auto; max-width: 380px; color: var(--muted); }
.center-state .btn-primary { width: auto; min-width: 240px; }
.center-state .field { text-align: left; margin: 22px 0 0; }

.secret-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.secret-head h3 { margin: 0; font-size: 17px; }
.secret-head p { margin: 2px 0 0; font-size: 13px; color: var(--muted); }

.ring { position: relative; width: 64px; height: 64px; flex: none; }
.ring svg { width: 64px; height: 64px; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 5; }
.ring .track { stroke: var(--surface-2); }
.ring .progress { stroke: var(--purple); stroke-linecap: round; transition: stroke-dashoffset 1s linear, stroke 0.3s; }
.ring.low .progress { stroke: var(--danger); }
.ring span { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 700; font-size: 15px; font-variant-numeric: tabular-nums; }

.secret-value {
  margin: 0;
  padding: 18px;
  min-height: 90px;
  max-height: 320px;
  overflow: auto;
  border-radius: 14px;
  background: #16102a;
  color: #f3eaff;
  border: 1px solid #2c2247;
  font: 14px/1.6 var(--mono);
  white-space: pre-wrap;
  word-break: break-all;
}

.footer-note { margin-top: 20px; display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.footer-note svg { width: 14px; height: 14px; flex: none; }

/* ---------- Animación ---------- */
.fade-in { animation: fade 0.35s ease-out both; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; }
  .brand { padding: 24px 16px 28px; }
  .brand-body { padding: 24px 0 0; }
  .brand h1 { font-size: 28px; }
  .brand p.lead { margin-bottom: 0; font-size: 14.5px; }
  .features { display: none; }
  .tagline { display: none; }
  .content { padding: 24px 16px 48px; align-items: flex-start; }
}
@media (max-width: 480px) {
  .card { padding: 20px; border-radius: 16px; }
  .linkbox { flex-direction: column; }
  .linkbox .btn { width: 100%; }
  .chips input { min-width: 140px; }
}

/* ---------- Archivo adjunto ---------- */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.file-drop {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 16px; border: 1.5px dashed var(--border); border-radius: 12px;
  color: var(--muted); font-size: 14px; cursor: pointer; transition: border-color .15s, background .15s;
}
.file-drop strong { color: var(--purple); font-weight: 600; }
.file-drop svg { width: 20px; height: 20px; flex-shrink: 0; }
.file-drop:hover, .file-drop.dragover, #file-input:focus-visible + .file-drop { border-color: var(--purple); background: var(--surface-2); }
.file-chip {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2);
}
.file-chip > svg { width: 20px; height: 20px; flex-shrink: 0; color: var(--purple); }
.file-chip .file-name { font-family: var(--mono); font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.file-chip .hint { margin-right: auto; white-space: nowrap; }
.file-chip > button:not(.btn) { width: 28px; height: 28px; border: 0; border-radius: 50%; display: grid; place-items: center; background: transparent; color: var(--muted); cursor: pointer; padding: 0; }
.file-chip > button:not(.btn):hover { background: var(--border); color: var(--text); }
.file-chip > button:not(.btn) svg { width: 14px; height: 14px; }
.file-download { margin-top: 12px; }
#file-invalid { margin-top: 12px; }
