:root {
  --bg: #f6f6f7;
  --card: #ffffff;
  --text: #111111;
  --muted: #6b6b73;
  --line: #e6e6ea;
  --primary: #FF0042;
  --primary-hover: #D6003A;
  --brand-black: #000000;
  --primary-soft: #FFE5EC;
  --ok: #1a8a4a;
  --warn: #b7791f;
  --danger: #c0392b;
  --radius: 10px;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: Inter, system-ui, sans-serif; background: var(--bg); color: var(--text); font-size: 15px; }
a { color: var(--primary); }
[hidden] { display: none !important; }
h1 { font-size: 1.5rem; margin: 0 0 4px; }
h2 { font-size: 1.15rem; margin: 0 0 12px; }
h3 { font-size: .95rem; margin: 18px 0 8px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.muted { color: var(--muted); }
.sm { font-size: .82rem; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.end { justify-content: flex-end; }
.mt { margin-top: 16px; }

.topbar { display: flex; justify-content: space-between; align-items: center; padding: 12px 24px; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.brand { font-weight: 700; text-decoration: none; color: var(--text); font-size: 1.1rem; }
.logo { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--primary); color: #fff; margin-right: 6px; }
.topbar-right { display: flex; gap: 12px; align-items: center; }

main { max-width: 1200px; margin: 0 auto; padding: 24px 16px 60px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }

.btn { border: 1px solid transparent; border-radius: 8px; padding: 9px 16px; font: inherit; font-weight: 600; cursor: pointer; background: #ececef; color: var(--text); text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--primary); color: #fff; }
.btn.primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn.ghost { background: transparent; border-color: var(--line); }
.btn.danger { background: transparent; color: var(--danger); border-color: #f0c8c3; }
.btn.ok { background: var(--ok); color: #fff; }
.btn.sm { padding: 5px 10px; font-size: .85rem; }
.btn.block { width: 100%; justify-content: center; }

label { display: block; font-weight: 500; margin: 12px 0 5px; font-size: .9rem; }
input[type=text], input[type=email], input[type=password], textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font: inherit; background: #fff; color: var(--text); }
input:focus, textarea:focus { outline: 2px solid #ff8aa7; border-color: var(--primary); }
.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; font-size: .88rem; }
.error { color: var(--danger); font-size: .88rem; min-height: 1.2em; margin-top: 8px; }

/* Auth */
.auth-wrap { max-width: 420px; margin: 6vh auto; }
.auth-wrap .brand-big { text-align: center; margin-bottom: 18px; }
.auth-wrap .brand-big .logo { width: 48px; height: 48px; font-size: 1.5rem; border-radius: 12px; }

/* Dashboard */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tab { background: none; border: none; padding: 10px 14px; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.doc-list { display: flex; flex-direction: column; gap: 8px; }
.doc-item { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 8px; text-decoration: none; color: inherit; background: #fff; }
.doc-item:hover { border-color: #ff8aa7; background: #fff7f9; }
.doc-item .title { font-weight: 600; }
.empty { text-align: center; padding: 40px; color: var(--muted); }
.badge { display: inline-block; padding: 3px 9px; border-radius: 99px; font-size: .75rem; font-weight: 600; white-space: nowrap; }
.badge.pending { background: #fff4de; color: var(--warn); }
.badge.signed, .badge.completed { background: #e1f5e9; color: var(--ok); }
.badge.declined, .badge.voided { background: #fde8e6; color: var(--danger); }
.badge.action { background: var(--primary); color: #fff; }

/* Nuevo documento */
.dropzone { border: 2px dashed #d9d9de; border-radius: 10px; padding: 28px; text-align: center; cursor: pointer; background: #fff7f9; }
.dropzone.drag { border-color: var(--primary); background: var(--primary-soft); }
.signer-row { display: grid; grid-template-columns: 1fr 1.3fr auto; gap: 8px; margin-bottom: 8px; }

/* Vista de documento */
.doc-layout { display: grid; grid-template-columns: 1fr 340px; gap: 20px; align-items: start; }
.viewer { background: #e4e8f1; border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; align-items: center; gap: 16px; min-height: 400px; }
.page-wrap { position: relative; box-shadow: 0 2px 10px rgba(20, 30, 60, .15); background: #fff; max-width: 100%; }
.page-wrap canvas { display: block; width: 100%; height: auto; }
.page-wrap.placing { cursor: crosshair; }
.sig-box { position: absolute; border: 2px dashed var(--primary); background: rgba(255, 0, 66, .06); cursor: move; touch-action: none; }
.sig-box img { width: 100%; height: 100%; pointer-events: none; }
.sig-box .handle { position: absolute; right: -7px; bottom: -7px; width: 14px; height: 14px; background: var(--primary); border-radius: 3px; cursor: nwse-resize; }
.side { position: sticky; top: 76px; display: flex; flex-direction: column; gap: 14px; }
.signer { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.signer:last-child { border-bottom: none; }
.signer .name { font-weight: 600; font-size: .9rem; }
.audit { max-height: 300px; overflow: auto; font-size: .8rem; }
.audit div { padding: 6px 0; border-bottom: 1px solid var(--line); word-break: break-word; }
.place-banner { position: sticky; top: 62px; z-index: 15; background: var(--primary); color: #fff; padding: 12px 16px; border-radius: 8px; display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.place-banner .btn.ghost { color: #fff; border-color: rgba(255,255,255,.5); }

/* Modal */
.modal-bg { position: fixed; inset: 0; background: rgba(15, 22, 40, .5); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: #fff; border-radius: 12px; padding: 22px; width: min(640px, 100%); }
#sigCanvas { width: 100%; height: auto; aspect-ratio: 3 / 1; border: 1px solid var(--line); border-radius: 8px; background: #fff; touch-action: none; cursor: crosshair; }
.typed-preview { font-family: 'Dancing Script', cursive; font-size: 3rem; min-height: 90px; border: 1px solid var(--line); border-radius: 8px; margin-top: 10px; display: grid; place-items: center; color: #10204f; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #000; color: #fff; padding: 12px 18px; border-radius: 8px; z-index: 60; max-width: 90vw; }
.toast.err { background: var(--danger); }

@media (max-width: 900px) {
  .doc-layout { grid-template-columns: 1fr; }
  .side { position: static; }
  .signer-row { grid-template-columns: 1fr; }
  .topbar { padding: 10px 16px; }
  #whoami { display: none; }
}

/* ---------- Marca GCC: barra negra, acentos #FF0042 ---------- */
.topbar { background: var(--brand-black); border-bottom: 3px solid var(--primary); }
.topbar .brand, .topbar #whoami { color: #fff; }
.topbar .btn.ghost { color: #fff; border-color: #444; }
.topbar .btn.ghost:hover { border-color: var(--primary); }
.topbar nav { display: flex; gap: 4px; }
.topbar nav a { color: #ccc; text-decoration: none; font-weight: 600; padding: 6px 10px; border-radius: 6px; }
.topbar nav a.active, .topbar nav a:hover { color: #fff; background: #1c1c1c; }
.brand-big h1 span, .accent { color: var(--primary); }
.auth-wrap .card { border-top: 4px solid var(--primary); }

/* Carpetas de eventos */
.folders { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.folder { position: relative; display: block; padding: 18px 16px 14px; border: 1px solid var(--line); border-radius: 10px; background: #fff; text-decoration: none; color: inherit; }
.folder::before { content: ''; position: absolute; top: -1px; left: 14px; width: 54px; height: 6px; background: var(--primary); border-radius: 0 0 4px 4px; }
.folder:hover { border-color: var(--primary); box-shadow: 0 4px 14px rgba(255, 0, 66, .12); }
.folder .ico { font-size: 1.6rem; }
.folder .name { font-weight: 700; margin: 6px 0 4px; word-break: break-word; }
.folder.new { display: grid; place-items: center; text-align: center; border-style: dashed; color: var(--muted); min-height: 120px; cursor: pointer; font: inherit; width: 100%; }
.folder.new::before { display: none; }
.pill { display: inline-block; background: var(--primary); color: #fff; border-radius: 99px; font-size: .72rem; font-weight: 700; padding: 2px 8px; }
select { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font: inherit; background: #fff; color: var(--text); }
.hint { font-size: .8rem; color: var(--muted); margin-top: 6px; }
.crumbs { font-size: .85rem; }

/* Logo GCC */
.brand { display: inline-flex; align-items: center; gap: 10px; }
.logo-img { width: 30px; height: 30px; object-fit: contain; display: block; }
.logo-big { width: 72px; height: 72px; object-fit: contain; display: block; margin: 0 auto; }

/* Botón de Google y separador */
.btn.google { background: #fff; color: #1f1f1f; border: 1px solid #dadce0; font-weight: 600; gap: 10px; }
.btn.google:hover { background: #f8f9fa; border-color: #c6c6c6; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .8rem; margin: 18px 0 4px; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }
#whoami .pill { vertical-align: middle; }
