:root {
  --white: #FFFFFF;
  --off-white: #F7F9FC;
  --soft-white: #FAFBFD;
  --ink: #1A1A1A;
  --ink-2: #2D3748;
  --ink-soft: #4A5568;
  --ink-light: #718096;
  --rule: #E2E8F0;
  --rule-soft: #EDF2F7;
  --blue-soft: #A3C4D9;
  --blue-mid: #8AB4F8;
  --blue-deep: #3174AD;
  --blue-dark: #1E5A8A;
  --blue-tint: #EBF3FA;
  --blue-ghost: #F3F8FC;
  --density: 1;
}
* { -webkit-font-smoothing: antialiased; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--white);
  color: var(--ink);
  font-feature-settings: "ss01", "cv11";
}
.display { font-family: 'Poppins', 'Inter', sans-serif; letter-spacing: -0.02em; }
.hand { font-family: 'Caveat', cursive; }

/* Density-controlled section padding */
section[class*="py-20"], section[class*="py-24"], section[class*="py-28"] {
  padding-top: calc(5rem * var(--density));
  padding-bottom: calc(5rem * var(--density));
}
@media (min-width: 768px) {
  section[class*="md:py-24"] { padding-top: calc(6rem * var(--density)); padding-bottom: calc(6rem * var(--density)); }
  section[class*="md:py-28"] { padding-top: calc(7rem * var(--density)); padding-bottom: calc(7rem * var(--density)); }
}

/* Pills / CTAs */
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.875rem 1.75rem; border-radius: 9999px;
  font-weight: 600; font-size: 0.95rem;
  transition: all 0.2s ease; white-space: nowrap;
}
.btn-primary {
  background: var(--blue-deep); color: white;
  box-shadow: 0 4px 12px rgba(49, 116, 173, 0.2);
}
.btn-primary:hover {
  background: var(--blue-dark);
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(49, 116, 173, 0.32);
}
.btn-ghost {
  background: white; color: var(--ink);
  border: 1.5px solid var(--rule);
}
.btn-ghost:hover { border-color: var(--blue-deep); color: var(--blue-deep); }
.btn-lg { padding: 1.05rem 2.15rem; font-size: 1.0125rem; }

.pill {
  display: inline-flex; align-items: center; gap: 0.375rem;
  padding: 0.4rem 0.875rem; border-radius: 9999px;
  font-size: 0.8125rem; font-weight: 500;
  background: var(--blue-tint); color: var(--blue-deep);
}
.pill-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--blue-deep);
}

.card {
  background: white; border-radius: 16px;
  border: 1px solid var(--rule);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.06);
  transition: all 0.25s ease;
}
.card:hover {
  box-shadow: 0 10px 30px rgba(49, 116, 173, 0.08);
  border-color: var(--blue-soft);
}
.card-lg { border-radius: 20px; }

.bg-off { background: var(--off-white); }
.bg-soft { background: var(--soft-white); }
.bg-tint { background: var(--blue-tint); }
.bg-ghost { background: var(--blue-ghost); }

.text-blue { color: var(--blue-deep); }
.bg-blue { background: var(--blue-deep); }
.bg-blue-soft { background: var(--blue-soft); }
.text-ink-soft { color: var(--ink-soft); }
.text-ink-light { color: var(--ink-light); }

.marker {
  font-family: 'Caveat', cursive;
  color: var(--blue-deep);
  font-weight: 600;
  font-size: 1.35rem;
  line-height: 1;
}

.tilt-left { transform: rotate(-3deg); }
.tilt-right { transform: rotate(3deg); }
.tilt-left-sm { transform: rotate(-1.5deg); }
.tilt-right-sm { transform: rotate(1.5deg); }

.icon-box {
  width: 44px; height: 44px; border-radius: 12px;
  background: var(--blue-tint); color: var(--blue-deep);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 22px;
}
.icon-box-lg { width: 56px; height: 56px; border-radius: 14px; font-size: 28px; }

.eyebrow {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-size: 0.8125rem; font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--blue-deep);
  text-transform: uppercase;
}
.eyebrow-line {
  width: 24px; height: 2px;
  background: var(--blue-deep);
  border-radius: 2px;
}

.brief-line {
  height: 8px; border-radius: 4px;
  background: var(--rule-soft);
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.9); }
}
.signal-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #22C55E;
  animation: pulse-dot 2s ease-in-out infinite;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.15);
}

.avatar {
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue-soft), var(--blue-mid));
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; color: white;
  letter-spacing: 0.01em;
}
.avatar-lg { width: 72px; height: 72px; font-size: 1.4rem; }
.avatar-md { width: 44px; height: 44px; font-size: 0.9rem; }
.avatar-sm { width: 32px; height: 32px; font-size: 0.75rem; }

.divider { height: 1px; background: var(--rule); }

details.faq {
  border-bottom: 1px solid var(--rule);
  padding: 1.375rem 0;
}
details.faq summary {
  list-style: none; cursor: pointer;
  display: flex; justify-content: space-between; align-items: center;
  font-weight: 600; font-size: 1.0625rem; color: var(--ink);
}
details.faq summary::-webkit-details-marker { display: none; }
details.faq summary::after {
  content: "+"; font-size: 1.5rem; color: var(--blue-deep);
  font-weight: 400; transition: transform 0.25s;
}
details.faq[open] summary::after { transform: rotate(45deg); }
details.faq p {
  margin-top: 0.75rem; color: var(--ink-soft); line-height: 1.6;
}

.grad-text {
  background: linear-gradient(135deg, var(--blue-deep), var(--blue-mid));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.dotted-line {
  background-image: radial-gradient(circle, var(--blue-deep) 1px, transparent 1px);
  background-size: 8px 2px;
  background-repeat: repeat-x;
  background-position: 0 center;
  height: 2px;
}

/* ===== Hero inbox animation ===== */
.inbox {
  position: relative;
  background: white;
  border-radius: 20px;
  border: 1px solid var(--rule);
  box-shadow: 0 24px 60px rgba(16, 24, 40, 0.12);
  overflow: hidden;
}
.inbox-chrome {
  display: flex; align-items: center; gap: 6px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--rule);
  background: var(--soft-white);
}
.inbox-chrome .dot {
  width: 11px; height: 11px; border-radius: 50%;
}
.inbox-chrome .dot.r { background: #FF5F57; }
.inbox-chrome .dot.y { background: #FEBC2E; }
.inbox-chrome .dot.g { background: #28C840; }
.inbox-title {
  margin-left: 10px; font-size: 13px; font-weight: 600;
  color: var(--ink-soft);
}
.inbox-list { padding: 6px 0; }
.inbox-row {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--rule-soft);
  cursor: pointer;
  transition: background 0.15s;
}
.inbox-row:hover { background: var(--off-white); }
.inbox-row.new {
  background: linear-gradient(90deg, rgba(49,116,173,0.08), transparent);
  border-left: 3px solid var(--blue-deep);
}
.inbox-row .sender { font-weight: 600; font-size: 14px; color: var(--ink); }
.inbox-row .preview { font-size: 13px; color: var(--ink-light); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inbox-row .time { font-size: 12px; color: var(--ink-light); }
.inbox-row .unread-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--blue-deep);
  margin-left: auto; margin-right: 8px;
}

/* incoming email animation */
@keyframes slideIn {
  from { opacity: 0; transform: translateY(-12px); max-height: 0; }
  to { opacity: 1; transform: translateY(0); max-height: 80px; }
}
.inbox-row.incoming {
  animation: slideIn 0.5s ease-out;
  background: linear-gradient(90deg, rgba(49,116,173,0.14), rgba(49,116,173,0.02));
  border-left: 3px solid var(--blue-deep);
}

/* Opened email */
.inbox-open {
  padding: 22px 24px;
  animation: fadeIn 0.4s ease-out;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Hero floating labels */
.hero-floater {
  position: absolute;
  background: white;
  border: 1px solid var(--rule);
  border-radius: 9999px;
  padding: 8px 14px;
  box-shadow: 0 8px 20px rgba(16, 24, 40, 0.08);
  z-index: 20;
}

/* ===== Brief preview tabs ===== */
.brief-tabs {
  display: inline-flex;
  background: var(--off-white);
  border: 1px solid var(--rule);
  border-radius: 9999px;
  padding: 4px;
}
.brief-tab {
  padding: 8px 18px;
  border-radius: 9999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.brief-tab.active {
  background: white;
  color: var(--blue-deep);
  box-shadow: 0 1px 3px rgba(16,24,40,0.08);
}

.move-row {
  transition: all 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.move-row.highlight {
  transform: translateX(4px);
  box-shadow: 0 4px 14px rgba(49, 116, 173, 0.12);
}

/* ===== Signal feed ===== */
.signal-row {
  animation: signalSlide 0.5s ease-out;
}
@keyframes signalSlide {
  from { opacity: 0; transform: translateY(-8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ===== Audit form ===== */
.af-step {
  animation: fadeIn 0.35s ease-out;
}
.af-input, .af-textarea {
  width: 100%;
  padding: 14px 16px;
  border: 1.5px solid var(--rule);
  border-radius: 12px;
  font-size: 15px;
  font-family: inherit;
  background: white;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.af-input:focus, .af-textarea:focus {
  outline: none;
  border-color: var(--blue-deep);
  box-shadow: 0 0 0 4px rgba(49,116,173,0.12);
}
.af-textarea { resize: vertical; min-height: 110px; }
.af-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
  margin-bottom: 6px;
  display: block;
}
.af-error {
  font-size: 12px;
  color: #DC2626;
  margin-top: 6px;
}
.af-pick {
  display: block;
  padding: 14px 16px;
  border: 1.5px solid var(--rule);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.15s;
  background: white;
}
.af-pick:hover { border-color: var(--blue-soft); }
.af-pick.selected {
  border-color: var(--blue-deep);
  background: var(--blue-tint);
}
.af-progress {
  height: 4px;
  background: var(--rule);
  border-radius: 2px;
  overflow: hidden;
}
.af-progress-bar {
  height: 100%;
  background: var(--blue-deep);
  transition: width 0.3s ease;
}

/* ===== Tweaks panel ===== */
.tweaks-panel {
  position: fixed;
  bottom: 20px; right: 20px;
  width: 320px;
  background: white;
  border: 1px solid var(--rule);
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(16, 24, 40, 0.16);
  padding: 18px;
  z-index: 100;
  font-size: 13px;
}
.tweaks-panel h4 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 12px;
}
.tweaks-row { margin-bottom: 12px; }
.tweaks-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-light);
  margin-bottom: 6px;
  display: block;
}
.tweaks-swatches {
  display: flex; gap: 8px;
}
.tweaks-swatch {
  width: 28px; height: 28px;
  border-radius: 8px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.15s;
}
.tweaks-swatch:hover { transform: scale(1.1); }
.tweaks-swatch.active { border-color: var(--ink); }
.tweaks-options {
  display: inline-flex;
  background: var(--off-white);
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 2px;
}
.tweaks-opt {
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.15s;
}
.tweaks-opt.active {
  background: white;
  color: var(--blue-deep);
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}

/* Dark mode */
body.dark {
  --white: #0E141B;
  --off-white: #141B24;
  --soft-white: #171F2A;
  --ink: #F1F5F9;
  --ink-2: #E2E8F0;
  --ink-soft: #B8C2CF;
  --ink-light: #8A97A8;
  --rule: #253040;
  --rule-soft: #1C2532;
  --blue-tint: #172638;
  --blue-ghost: #121B26;
}
body.dark .card { background: #141B24; }
body.dark .btn-ghost { background: #141B24; }
body.dark .inbox { background: #141B24; }
body.dark .inbox-chrome { background: #0E141B; }
body.dark .brief-tabs, body.dark .tweaks-options { background: #0E141B; }
body.dark .af-input, body.dark .af-textarea, body.dark .af-pick { background: #141B24; color: var(--ink); }
body.dark .tweaks-panel { background: #141B24; }
body.dark .hero-floater { background: #141B24; }
