/* ===== Mail Mass — WhatsApp-Tool shell, UNHCR blue theme ===== */
:root {
  --unhcr-blue-06: #0B3754;
  --unhcr-blue-05: #05568B;
  --unhcr-blue: #0072BC;
  --unhcr-blue-03: #4F9ED0;
  --unhcr-blue-01: #CDE3F1;
  --unhcr-yellow: #FFC740;
  --bg: #f4f7fb;
  --bg-card: #ffffff;
  --bg-elevated: #f7fbfe;
  --border: #e2e8ef;
  --border-focus: #0072BC;
  --text: #0B3754;
  --text-muted: #5a7390;
  --accent: #0072BC;
  --accent-dark: #05568B;
  --accent-light: #CDE3F1;
  --accent-glow: rgba(0, 114, 188, 0.18);
  --danger: #dc2626;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(11, 55, 84, 0.06), 0 4px 16px rgba(11, 55, 84, 0.04);
  --shadow-lg: 0 4px 24px rgba(11, 55, 84, 0.1);
  --font: "Outfit", system-ui, sans-serif;
  --display: "Fraunces", var(--font);
  --transition: 0.2s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

/* ===== HERO (blue) ===== */
.hero {
  position: relative;
  min-height: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0.65rem 1rem 2rem;
  overflow: hidden;
  background:
    radial-gradient(ellipse 90% 80% at 50% -10%, rgba(79, 158, 208, 0.55) 0%, transparent 58%),
    linear-gradient(165deg, #b8d9f0 0%, #d6ebf8 45%, rgba(245, 249, 252, 0.55) 78%, transparent 100%);
}

.hero::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 44px;
  z-index: 5;
  pointer-events: none;
  background: linear-gradient(
    to bottom,
    transparent 0%,
    rgba(244, 247, 251, 0.25) 30%,
    rgba(244, 247, 251, 0.72) 62%,
    var(--bg) 100%
  );
}

.hero-mesh {
  position: absolute;
  inset: -50% -20% -30%;
  z-index: 0;
  background:
    radial-gradient(circle at 50% 20%, rgba(0, 114, 188, 0.45) 0%, transparent 38%),
    radial-gradient(circle at 20% 40%, rgba(5, 86, 139, 0.32) 0%, transparent 35%),
    radial-gradient(circle at 80% 35%, rgba(79, 158, 208, 0.35) 0%, transparent 35%);
  filter: blur(40px);
  animation: mesh-drift 14s ease-in-out infinite alternate;
  pointer-events: none;
}

@keyframes mesh-drift {
  0% { transform: translate(0, 0) rotate(0deg) scale(1); }
  100% { transform: translate(-4%, 3%) rotate(2deg) scale(1.06); }
}

.hero-orbs {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}

.hero-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(32px);
  opacity: 0.55;
  animation: orb-float 10s ease-in-out infinite alternate;
}

.hero-orb--1 {
  width: 120px;
  height: 120px;
  background: rgba(0, 114, 188, 0.55);
  top: -30px;
  left: 18%;
  animation-duration: 11s;
}

.hero-orb--2 {
  width: 90px;
  height: 90px;
  background: rgba(79, 158, 208, 0.55);
  bottom: 10px;
  right: 15%;
  animation-duration: 9s;
  animation-delay: -3s;
}

.hero-orb--3 {
  width: 70px;
  height: 70px;
  background: rgba(11, 55, 84, 0.4);
  top: 8%;
  right: 32%;
  animation-duration: 13s;
  animation-delay: -6s;
}

@keyframes orb-float {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(12px, -18px) scale(1.12); }
}

.hero-bubbles {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.chat-bubble {
  position: absolute;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.55);
  filter: blur(6px);
  animation: bubble-drift 8s ease-in-out infinite alternate;
}

.cb-1 { width: 72px; height: 36px; top: 18%; left: 14%; animation-duration: 7s; }
.cb-2 { width: 56px; height: 28px; bottom: 22%; right: 18%; border-radius: 14px; animation-duration: 9s; animation-delay: -2s; }
.cb-3 { width: 44px; height: 22px; top: 55%; left: 6%; border-radius: 12px; animation-duration: 11s; animation-delay: -4s; }

@keyframes bubble-drift {
  0% { transform: translateY(0) rotate(0deg); opacity: 0.5; }
  100% { transform: translateY(-10px) rotate(3deg); opacity: 0.75; }
}

.hero-emoji-field {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
}

.jump-emoji {
  position: absolute;
  font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif;
  font-size: clamp(1.1rem, 2.4vw, 1.65rem);
  line-height: 1;
  filter: drop-shadow(0 3px 10px rgba(0, 114, 188, 0.28));
  animation: emoji-jump var(--dur, 4.5s) cubic-bezier(0.42, 0, 0.2, 1) infinite;
  animation-delay: var(--delay, 0s);
  will-change: transform;
}

.jump-emoji.is-far {
  opacity: 0.38;
  font-size: clamp(0.85rem, 1.8vw, 1.25rem);
  filter: blur(0.5px) drop-shadow(0 2px 6px rgba(0, 114, 188, 0.1));
}

@keyframes emoji-jump {
  0%, 100% { transform: translateY(0) scale(1) rotate(0deg); }
  12% { transform: translateY(-34px) scale(1.14) rotate(-6deg); }
  28% { transform: translateY(0) scale(0.94) rotate(0deg); }
  44% { transform: translateY(-20px) scale(1.06) rotate(4deg); }
  60% { transform: translateY(0) scale(1) rotate(0deg); }
}

.je-1  { left: 4%;   top: 8%;  --dur: 4.2s; --delay: 0s; }
.je-2  { left: 14%;  top: 52%; --dur: 5.4s; --delay: -1.2s; }
.je-3  { left: 26%;  top: 5%;  --dur: 4.8s; --delay: -2.1s; }
.je-4  { left: 38%;  top: 58%; --dur: 5.8s; --delay: -0.5s; }
.je-6  { left: 62%;  top: 48%; --dur: 5.1s; --delay: -1.7s; }
.je-7  { left: 74%;  top: 10%; --dur: 5.6s; --delay: -0.8s; }
.je-8  { left: 88%;  top: 42%; --dur: 4.4s; --delay: -2.5s; }
.je-9  { left: 8%;   top: 28%; --dur: 6s;   --delay: -3.4s; }
.je-11 { left: 36%;  top: 22%; --dur: 4.1s; --delay: -2.4s; }
.je-12 { left: 58%;  top: 65%; --dur: 5.7s; --delay: -3.8s; opacity: 0.55; }
.je-13 { left: 70%;  top: 26%; --dur: 5s;   --delay: -0.3s; }
.je-14 { left: 82%;  top: 55%; --dur: 3.8s; --delay: -2.8s; }
.je-16 { left: 93%;  top: 6%;  --dur: 5.2s; --delay: -1.9s; font-size: clamp(1.3rem, 2.8vw, 1.9rem); }

.hero-content {
  position: relative;
  z-index: 6;
  text-align: center;
}

.hero-title {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.12rem;
  margin: 0;
  line-height: 1;
}

.hero-title-brand {
  font-family: var(--font);
  font-size: clamp(1.4rem, 3.8vw, 1.75rem);
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--unhcr-blue-06);
  text-shadow: 0 1px 14px rgba(255, 255, 255, 0.75);
}

.hero-title-tool {
  font-family: var(--display);
  font-size: clamp(0.78rem, 2.1vw, 0.92rem);
  font-weight: 800;
  letter-spacing: 0.42em;
  text-transform: uppercase;
  color: var(--unhcr-blue-05);
  padding-left: 0.42em;
}

@media (prefers-reduced-motion: reduce) {
  .hero-mesh,
  .hero-orb,
  .chat-bubble,
  .jump-emoji {
    animation: none !important;
  }
}

/* ===== MAIN ===== */
.main {
  max-width: 900px;
  margin: 0.35rem auto 1.5rem;
  padding: 0 1rem 2rem;
  position: relative;
  z-index: 6;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
}

.page-lead {
  color: var(--text-muted);
  font-size: 0.92rem;
  max-width: 44rem;
  margin: 0 0 0.15rem;
}

.sheet-example-label {
  margin: 0.35rem 0 0.35rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
}

.sheet-example {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  width: 100%;
  max-width: 44rem;
  margin: 0 0 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-card);
  box-shadow: var(--shadow);
}

.sheet-example span {
  flex: 1 1 auto;
  min-width: 5.5rem;
  padding: 0.55rem 0.7rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text);
  background: color-mix(in srgb, var(--accent, #0072bc) 8%, #fff);
  border-right: 1px solid var(--border);
  text-align: center;
  white-space: nowrap;
}

.sheet-example span:last-child {
  border-right: none;
}

/* ===== TABS ===== */
.tabs {
  display: flex;
  gap: 0.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.25rem;
  margin-bottom: 0.15rem;
  box-shadow: var(--shadow);
  text-decoration: none;
}

.tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  padding: 0.42rem 0.35rem;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.74rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  text-decoration: none;
}

.tab-icon { font-size: 0.88rem; }

.tab:hover {
  color: var(--text);
  background: var(--bg-elevated);
}

.tab.active {
  background: var(--unhcr-blue-06);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 114, 188, 0.25);
}

/* ===== CARD / PANEL ===== */
.panel { display: block; }

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem;
  box-shadow: var(--shadow);
}

.card-header { margin-bottom: 1rem; }

.step {
  font-size: 1rem;
  font-weight: 700;
  color: var(--unhcr-blue-06);
  letter-spacing: -0.01em;
}

.count {
  display: inline-block;
  margin-left: 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  background: var(--accent-light);
  color: var(--accent);
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  vertical-align: middle;
}

/* ===== DROPZONE ===== */
.dropzone {
  border: 2px dashed var(--unhcr-blue-03);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  padding: 1.35rem 1rem;
  text-align: center;
  transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
}

.dropzone.is-drag {
  border-color: var(--accent);
  background: var(--accent-light);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.drop-title { font-weight: 600; color: var(--text); }
.drop-sub { margin-top: 0.25rem; color: var(--text-muted); font-size: 0.9rem; }

.link-btn {
  background: none;
  border: none;
  color: var(--accent);
  font: inherit;
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
}

.dropzone-file {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  font-weight: 700;
}

.btn-icon {
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 0.2rem 0.35rem;
  border-radius: var(--radius-sm);
}

.btn-icon:hover { color: var(--danger); }

/* ===== FORMS ===== */
.map-grid,
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem 1rem;
  margin-top: 0.85rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.field-full { grid-column: 1 / -1; }

.field label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.req { color: var(--danger); }
.opt { font-weight: 400; opacity: 0.85; }

.hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.35;
}

.field input,
.field select,
.field textarea {
  font: inherit;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.field textarea { resize: vertical; min-height: 110px; }

/* ===== RICH TEXT (Word-like) ===== */
.rte-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  overflow: hidden;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.rte-wrap:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.rte-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.2rem;
  padding: 0.35rem 0.4rem;
  background: linear-gradient(180deg, #f7f8fa 0%, #eef1f5 100%);
  border-bottom: 1px solid var(--border);
}

.rte-select {
  font: inherit;
  font-size: 0.78rem;
  padding: 0.28rem 0.35rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fff;
  color: var(--text);
  max-width: 9.5rem;
}

.rte-size {
  max-width: 3.4rem;
}

.rte-sep {
  width: 1px;
  height: 1.35rem;
  background: var(--border);
  margin: 0 0.15rem;
}

.rte-btn {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  min-width: 1.7rem;
  height: 1.7rem;
  padding: 0 0.35rem;
  border-radius: 4px;
  cursor: pointer;
  line-height: 1;
}

.rte-btn:hover {
  background: #fff;
  border-color: var(--border);
}

.rte-btn:active,
.rte-btn.is-active {
  background: var(--accent-light);
  border-color: var(--unhcr-blue-03);
  color: var(--unhcr-blue-06);
}

.rte-btn b { font-weight: 800; }
.rte-btn i { font-style: italic; }
.rte-btn u { text-decoration: underline; }
.rte-btn s { text-decoration: line-through; }

.rte-color {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.7rem;
  height: 1.7rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
  overflow: hidden;
}

.rte-color input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  padding: 0;
  border: none;
  width: 100%;
  height: 100%;
}

.rte-color-swatch {
  width: 0.95rem;
  height: 0.95rem;
  border-radius: 2px;
  background: #000;
  box-shadow: inset 0 -2px 0 #0072bc;
  pointer-events: none;
}

.rte-color-swatch.rte-hl {
  background: #ffff00;
  box-shadow: inset 0 -2px 0 #333;
}

.rte-editor {
  min-height: 160px;
  max-height: 320px;
  overflow: auto;
  padding: 0.7rem 0.85rem;
  font-family: Calibri, 'Segoe UI', sans-serif;
  font-size: 11pt;
  line-height: 1.45;
  color: #000;
  outline: none;
}

.rte-editor:empty:before {
  content: attr(data-placeholder);
  color: var(--text-muted);
  white-space: pre-wrap;
  pointer-events: none;
}

.rte-editor p { margin: 0 0 0.55em; }
.rte-editor ul,
.rte-editor ol { margin: 0 0 0.55em; padding-left: 1.4em; }

.greeting-preview {
  font-family: Calibri, 'Segoe UI', sans-serif;
  font-size: 11pt;
  font-weight: 400;
  color: #000;
  padding: 0.55rem 0.7rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.greeting-preview em {
  font-style: normal;
  font-weight: 400;
  color: #000;
  border-bottom: 1px dashed var(--unhcr-blue-03);
}

.radio-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1.1rem;
}

.radio {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  font-size: 0.9rem;
}

.param-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.45rem;
}

.param-chip {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--unhcr-blue-05);
  font: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.5rem;
  border-radius: 999px;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}

.param-chip:hover {
  background: var(--accent-light);
  border-color: var(--unhcr-blue-03);
}

.preview-box {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 0.85rem;
  box-shadow: var(--shadow);
}

.preview-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0.75rem;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
}

.preview-head h3 {
  font-size: 0.88rem;
  font-weight: 700;
}

.preview-body {
  margin: 0;
  padding: 0.75rem 0.85rem;
  max-height: 280px;
  overflow: auto;
  background: #fff;
}

.preview-meta {
  margin: 0 0 0.65rem;
  padding: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--font);
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.55rem;
}

.preview-mail {
  font-family: Calibri, 'Segoe UI', sans-serif;
  font-size: 11pt;
  line-height: 1.45;
  color: #000;
  word-break: break-word;
}

.preview-mail p { margin: 0 0 0.55em; }
.preview-mail ul,
.preview-mail ol { margin: 0 0 0.55em; padding-left: 1.4em; }

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem 0.75rem;
}

.actions-hint { width: 100%; margin-top: 0.15rem; }

.auth-row {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.55rem;
  margin: 0.85rem 0 0.75rem;
}

.outlook-status-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem 0.75rem;
  margin-bottom: 0.65rem;
}

.outlook-pill {
  display: inline-flex;
  align-items: center;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-muted);
}

.outlook-pill.is-on {
  color: #0b6b3a;
  background: #e7f7ee;
  border-color: #9fd4b3;
}

.outlook-pill.is-off {
  color: #8a4b00;
  background: #fff4e5;
  border-color: #f0c48a;
}

.outlook-pill.is-wait {
  color: var(--unhcr-blue-06);
  background: var(--accent-light);
  border-color: var(--unhcr-blue-03);
}

.outlook-status-row .hint {
  margin: 0;
  flex: 1 1 12rem;
}

.outlook-connect {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.55rem;
  padding: 0.85rem 0.95rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
}

.outlook-connect .btn {
  text-decoration: none;
  text-align: center;
}

.outlook-ready {
  margin-top: 0.35rem;
  color: var(--accent);
  font-weight: 600;
}

.auth-row .hint {
  flex: 1 1 auto;
  margin: 0;
}

.btn {
  font: inherit;
  font-weight: 600;
  border-radius: var(--radius-sm);
  padding: 0.55rem 1rem;
  border: 1px solid transparent;
  cursor: pointer;
  font-size: 0.88rem;
  transition: transform var(--transition), background var(--transition), box-shadow var(--transition);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 14px var(--accent-glow);
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-dark);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px var(--accent-glow);
}

.btn-secondary {
  background: #fff;
  border-color: var(--border);
  color: var(--text);
}

.btn-secondary:hover:not(:disabled) { background: var(--bg-elevated); }

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text-muted);
  padding: 0.4rem 0.65rem;
  font-size: 0.8rem;
}

.btn-lg { padding: 0.75rem 1.5rem; font-size: 0.92rem; }

.hidden { display: none !important; }

.toast-wrap {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  z-index: 40;
}

.toast {
  background: var(--unhcr-blue-06);
  color: #fff;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.86rem;
  box-shadow: 0 8px 22px rgba(11, 55, 84, 0.22);
  animation: toast-in 0.25s ease;
}

.toast.error { background: #9f1239; }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 640px) {
  .map-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .tabs {
    flex-direction: column;
  }
}
