/* Enjambre brand — same tokens as the marketing site (enjambre.store) */
:root {
  --hive-black: #14100a;
  --honey: #f2a900;
  --honey-strong: #ffcf3f;
  --amber-deep: #c97a0c;
  --parchment: #fbf3e1;
  --dark-text: #f4e9ce;

  --bg: var(--parchment);
  --card: #ffffff;
  --ink: #1a1207;
  --muted: #8a7857;
  --line: #e8ddc4;
  --brand: var(--honey);
  --brand-dark: var(--amber-deep);
  --send: var(--honey-strong);
  --send-dark: var(--amber-deep);
  --warn-bg: #fff6e5;
  --warn-ink: #8a5a00;
  --ok-bg: #e6f7ee;
  --ok-ink: #12794a;
  --err: #c0392b;
  --radius: 12px;

  --font-display: "Archivo Black", "Hanken Grotesk", system-ui, sans-serif;
  --font-body: "Hanken Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

/* Ensure the [hidden] attribute always wins over class-level display rules. */
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: var(--font-body);
  background-color: var(--bg);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='56' height='96' viewBox='0 0 56 96'><g fill='none' stroke='%23C97A0C' stroke-width='1' stroke-opacity='0.16'><polygon points='28,2 54,17 54,47 28,62 2,47 2,17'/><polygon points='28,50 54,65 54,95 28,110 2,95 2,65'/></g></svg>");
  background-size: 56px 96px;
  background-attachment: fixed;
  color: var(--ink);
  line-height: 1.5;
}

header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  background: var(--hive-black);
  color: var(--parchment);
  overflow: hidden;
}
header::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='56' height='96' viewBox='0 0 56 96'><g fill='none' stroke='%23F2A900' stroke-width='1' stroke-opacity='0.14'><polygon points='28,2 54,17 54,47 28,62 2,47 2,17'/><polygon points='28,50 54,65 54,95 28,110 2,95 2,65'/></g></svg>");
  background-size: 56px 96px;
  pointer-events: none;
}
header > * { position: relative; }
header h1 {
  font-family: var(--font-display);
  font-size: 18px;
  margin: 0;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.logo-hex { flex: none; transition: transform 0.6s ease; }
header h1:hover .logo-hex { transform: rotate(360deg); }

main {
  max-width: 820px;
  margin: 0 auto;
  padding: 24px 16px 48px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 24px;
}
.card h2 {
  margin: 0 0 6px;
  font-size: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.card h3 { font-size: 15px; margin: 0 0 10px; }

.num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--brand);
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
}

.muted { color: var(--muted); font-size: 14px; }
footer { text-align: center; padding: 20px; font-size: 13px; }

.status {
  font-size: 13px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
}
.status--ok { background: #0c6; }
.status--wait { background: #e0a800; }
.status--err { background: #c0392b; }

/* Buttons */
.btn {
  display: inline-block;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: filter 0.15s ease;
}
.btn:hover { filter: brightness(0.97); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn--primary,
.btn--send {
  position: relative;
  overflow: hidden;
  background: var(--brand);
  border-color: var(--brand);
  color: var(--ink);
  font-weight: 700;
  animation: honey-breath 3.8s ease-in-out infinite;
}
.btn--send { background: var(--send); border-color: var(--send); font-size: 17px; padding: 13px 26px; }
.btn--primary::before,
.btn--send::before {
  content: "";
  position: absolute;
  top: 0;
  left: -120%;
  width: 55%;
  height: 100%;
  background: linear-gradient(100deg, transparent 0%, rgba(255, 255, 255, 0.55) 50%, transparent 100%);
  transform: skewX(-18deg);
  transition: left 0.7s ease;
  pointer-events: none;
}
.btn--primary:hover::before,
.btn--send:hover::before { left: 130%; }
.btn--primary:disabled,
.btn--send:disabled { animation: none; }
@keyframes honey-breath {
  0%, 100% { box-shadow: 0 10px 30px -8px rgba(242, 169, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.45); }
  50% { box-shadow: 0 16px 44px -8px rgba(255, 207, 63, 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.55); }
}
.btn--small { padding: 5px 10px; font-size: 13px; }
.btn--danger { background: #fff; border-color: var(--err); color: var(--err); }
.btn--danger:hover { background: #fdecea; }

/* Step 1 */
#qr-wrap { display: flex; justify-content: center; padding: 10px 0; }
.qr-placeholder {
  width: 260px; height: 260px;
  display: flex; align-items: center; justify-content: center;
  border: 2px dashed var(--line); border-radius: 12px; color: var(--muted);
  text-align: center; padding: 20px;
}
#qr-img { width: 260px; height: 260px; }
#qr-actions { display: flex; align-items: center; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 6px; }
#qr-actions .muted { font-size: 13px; }
.ok-banner {
  background: var(--ok-bg); color: var(--ok-ink);
  padding: 14px; border-radius: 10px; font-weight: 600; text-align: center;
}
.connected-actions { margin-top: 10px; }
.err-banner {
  background: #fdecea; color: #b3261e;
  padding: 12px 14px; border-radius: 10px; font-weight: 600; margin-top: 6px;
}

/* Header controls + auth */
.header-right { display: flex; align-items: center; gap: 10px; }
.user-chip { color: #fff; font-size: 14px; font-weight: 600; opacity: 0.95; }
header .btn { background: rgba(255, 255, 255, 0.16); border-color: transparent; color: #fff; }
header .btn:hover { background: rgba(255, 255, 255, 0.28); }
header a.btn { text-decoration: none; }

/* Login page */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: var(--hive-black); }
.login-card { max-width: 380px; width: 100%; }
.login-card h1 {
  font-family: var(--font-display);
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 22px;
}
.field { display: block; margin: 12px 0; }
.field > span { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 5px; }
.field input, .field select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 10px; font-size: 15px; font-family: inherit; box-sizing: border-box;
}
.login-card .btn--primary { width: 100%; margin-top: 6px; }

/* Users table (admin) */
.users-table { width: 100%; border-collapse: collapse; }
.users-table th, .users-table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); font-size: 14px; }
.users-table th { color: var(--muted); font-weight: 600; }
.admin-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* Step 2 */
.dropzone {
  border: 2px dashed var(--line);
  border-radius: 12px;
  padding: 26px;
  text-align: center;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.dropzone.drag { border-color: var(--brand); background: #f0faf8; }
.dropzone .filename { font-weight: 600; color: var(--brand-dark); margin: 8px 0 0; }
.warnings {
  margin-top: 14px; background: var(--warn-bg); color: var(--warn-ink);
  padding: 12px 14px; border-radius: 10px; font-size: 13px;
}
.warnings ul { margin: 6px 0 0; padding-left: 18px; }
.summary { margin-top: 12px; font-weight: 600; }

/* Step 3 */
textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 10px;
  padding: 12px; font-size: 15px; font-family: inherit; resize: vertical;
  margin-bottom: 12px;
}
.progress-text { margin-top: 10px; font-size: 14px; color: var(--brand-dark); }

/* Step 4 */
#drafts { display: flex; flex-direction: column; gap: 12px; }
.draft {
  border: 1px solid var(--line); border-radius: 10px; padding: 14px;
}
.draft-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.draft-name { font-weight: 700; }
.draft-number { color: var(--muted); font-size: 13px; }
.draft textarea { min-height: 64px; margin-bottom: 8px; }
.token-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 8px 0 4px; }
.token-label { font-size: 13px; font-weight: 600; color: var(--muted); }
.token-hint { font-size: 12px; margin-left: 4px; }
.chip {
  font-size: 12px; font-weight: 600; padding: 4px 10px;
  border: 1px solid var(--line); border-radius: 999px;
  background: #f7f8fa; color: var(--brand-dark); cursor: pointer;
}
.chip:hover { background: #eef4f3; border-color: var(--brand); }

.attach-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 14px 0 0; }
.attach-preview {
  display: flex; align-items: center; gap: 12px;
  margin-top: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 10px;
}
.attach-thumb {
  width: 56px; height: 56px; flex: none; border-radius: 8px; overflow: hidden;
  background: #f2f3f5; display: flex; align-items: center; justify-content: center;
}
.attach-thumb img, .attach-thumb video { width: 100%; height: 100%; object-fit: cover; }
.attach-info { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.attach-info span:first-child { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.draft-actions { display: flex; gap: 8px; }
.draft.err { border-color: var(--err); }
.draft.pending { border-color: var(--brand); }
.draft.pending textarea { background: #f7fbfa; color: var(--muted); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }

/* Step 5 */
.checkbox { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; font-size: 14px; }
#notices { margin: 6px 0; display: flex; flex-direction: column; gap: 6px; }
.notice { padding: 10px 12px; border-radius: 8px; font-size: 13px; }
.notice--info { background: #eef4ff; color: #26437a; }
.notice--warn { background: var(--warn-bg); color: var(--warn-ink); }
.notice--error { background: #fdecea; color: var(--err); }

.panels { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
@media (max-width: 680px) { .panels { grid-template-columns: 1fr; } }
.panel { border: 1px solid var(--line); border-radius: 10px; padding: 14px; }

.send-list { display: flex; flex-direction: column; gap: 6px; max-height: 320px; overflow-y: auto; }
.send-row {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 7px 10px; border-radius: 8px; background: #f7f8fa; font-size: 13px;
}
.send-row .who { font-weight: 600; }
.badge { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px; white-space: nowrap; }
.badge--pending { background: #eceff1; color: #607d8b; }
.badge--sent { background: var(--ok-bg); color: var(--ok-ink); }
.badge--failed { background: #fdecea; color: var(--err); }
.badge--skipped { background: #f0eafc; color: #6b46c1; }

.responses { display: flex; flex-direction: column; gap: 8px; max-height: 320px; overflow-y: auto; }
.reply {
  border: 1px solid var(--line); border-radius: 8px; padding: 10px; background: #fff;
}
.reply.handled { opacity: 0.5; }
.reply-head { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.reply-body { font-size: 14px; }
.reply-optout { color: var(--err); font-weight: 700; font-size: 12px; }

.results-bar { margin-top: 16px; }

.step-disabled { opacity: 0.5; pointer-events: none; }
