/* Greenways agent email — branded “Email me this” preview (Wave 9).
   Matches desk / content-module chrome: glass panel, agent accent, letter layout. */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Playfair+Display:wght@600;700&display=swap');

.gw-mail-btn {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text, #e8edf8);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.gw-mail-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.28);
}
.gw-mail-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.compose-row .gw-mail-btn {
  align-self: flex-end;
}

.gw-mail-overlay {
  --mail-accent: #c9a961;
  --mail-accent-soft: rgba(201, 169, 97, 0.22);
  --mail-accent-border: rgba(201, 169, 97, 0.48);
  --mail-accent-glow: rgba(201, 169, 97, 0.18);
  --mail-ink: #f4f1ea;
  --mail-muted: rgba(232, 237, 248, 0.62);
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  background: rgba(4, 6, 14, 0.88);
  backdrop-filter: blur(8px);
  font-family: 'DM Sans', 'Segoe UI', sans-serif;
}
.gw-mail-overlay[hidden] {
  display: none !important;
}

/* Per-agent themes (content-module parity) */
.gw-mail-overlay.theme-finance {
  --mail-accent: #c9a961;
  --mail-accent-soft: rgba(201, 169, 97, 0.2);
  --mail-accent-border: rgba(201, 169, 97, 0.55);
  --mail-accent-glow: rgba(201, 169, 97, 0.2);
}
.gw-mail-overlay.theme-grants {
  --mail-accent: #60a5fa;
  --mail-accent-soft: rgba(59, 130, 246, 0.2);
  --mail-accent-border: rgba(59, 130, 246, 0.55);
  --mail-accent-glow: rgba(37, 99, 235, 0.22);
}
.gw-mail-overlay.theme-equipment {
  --mail-accent: #fb923c;
  --mail-accent-soft: rgba(249, 115, 22, 0.2);
  --mail-accent-border: rgba(249, 115, 22, 0.55);
  --mail-accent-glow: rgba(234, 88, 12, 0.22);
}
.gw-mail-overlay.theme-deals {
  --mail-accent: #38bdf8;
  --mail-accent-soft: rgba(56, 189, 248, 0.18);
  --mail-accent-border: rgba(56, 189, 248, 0.5);
  --mail-accent-glow: rgba(14, 165, 233, 0.2);
}
.gw-mail-overlay.theme-media {
  --mail-accent: #c084fc;
  --mail-accent-soft: rgba(168, 85, 247, 0.2);
  --mail-accent-border: rgba(168, 85, 247, 0.55);
  --mail-accent-glow: rgba(124, 58, 237, 0.25);
}
.gw-mail-overlay.theme-products {
  --mail-accent: #2dd4bf;
  --mail-accent-soft: rgba(45, 212, 191, 0.18);
  --mail-accent-border: rgba(45, 212, 191, 0.5);
  --mail-accent-glow: rgba(13, 148, 136, 0.22);
}
.gw-mail-overlay.theme-systems {
  --mail-accent: #fbbf24;
  --mail-accent-soft: rgba(251, 191, 36, 0.18);
  --mail-accent-border: rgba(251, 191, 36, 0.5);
  --mail-accent-glow: rgba(217, 119, 6, 0.2);
}

.gw-mail-panel {
  width: min(560px, 100%);
  max-height: min(90vh, 760px);
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  border: 2px solid var(--mail-accent-border);
  background:
    radial-gradient(ellipse 90% 55% at 12% -10%, var(--mail-accent-glow), transparent 55%),
    linear-gradient(165deg, rgba(18, 26, 40, 0.98), rgba(8, 12, 22, 0.98));
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.06) inset,
    0 28px 72px rgba(0, 0, 0, 0.55);
  color: var(--mail-ink);
  overflow: hidden;
}

.gw-mail-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent);
}
.gw-mail-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center 22%;
  border: 2px solid var(--mail-accent-border);
  box-shadow: 0 0 0 4px var(--mail-accent-soft);
  background: #0a121c;
  flex-shrink: 0;
}
.gw-mail-brand-text {
  flex: 1;
  min-width: 0;
}
.gw-mail-eyebrow {
  margin: 0 0 2px;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--mail-accent);
}
.gw-mail-brand-text h2 {
  margin: 0;
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.15;
  color: #fff;
}
.gw-mail-brand-text p {
  margin: 4px 0 0;
  font-size: 0.78rem;
  color: var(--mail-muted);
  line-height: 1.35;
}
.gw-mail-head-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  flex-shrink: 0;
}
.gw-mail-badge {
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 5px 9px;
  border-radius: 999px;
  border: 1px solid var(--mail-accent-border);
  color: var(--mail-accent);
  background: var(--mail-accent-soft);
  white-space: nowrap;
}
.gw-mail-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.05);
  color: #e8edf8;
  cursor: pointer;
  font-size: 1.15rem;
  line-height: 1;
}
.gw-mail-close:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--mail-accent-border);
}

.gw-mail-meta {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.gw-mail-meta-row {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 10px;
  align-items: baseline;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.84rem;
}
.gw-mail-meta-row:last-child {
  border-bottom: none;
}
.gw-mail-meta-row dt {
  margin: 0;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--mail-accent);
}
.gw-mail-meta-row dd {
  margin: 0;
  color: #eef2ff;
  word-break: break-word;
  line-height: 1.4;
}
.gw-mail-meta-row dd.muted {
  color: var(--mail-muted);
  font-style: italic;
}
.gw-mail-from-line {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.gw-mail-from-name {
  font-weight: 650;
  color: #fff;
}
.gw-mail-from-addr {
  font-size: 0.75rem;
  color: var(--mail-muted);
  font-family: ui-monospace, 'JetBrains Mono', Consolas, monospace;
}

.gw-mail-letter-wrap {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 14px 18px 8px;
}
.gw-mail-letter-label {
  margin: 0 0 10px;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--mail-muted);
}
.gw-mail-letter {
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background:
    linear-gradient(180deg, rgba(255, 252, 245, 0.97), rgba(248, 244, 236, 0.96));
  color: #1a2332;
  padding: 20px 20px 16px;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.65) inset,
    0 12px 28px rgba(0, 0, 0, 0.18);
}
.gw-mail-letter-mark {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(26, 35, 50, 0.12);
}
.gw-mail-letter-mark strong {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.05rem;
  color: #1a2332;
}
.gw-mail-letter-mark span {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #7a6540;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid rgba(201, 169, 97, 0.45);
  background: rgba(201, 169, 97, 0.12);
}
.gw-mail-greeting {
  margin: 0 0 12px;
  font-size: 0.95rem;
  font-weight: 600;
  color: #1a2332;
}
.gw-mail-prose {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.55;
  color: #2a3548;
  white-space: pre-wrap;
}
.gw-mail-cta {
  margin: 16px 0 0;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid rgba(201, 169, 97, 0.35);
  background: rgba(201, 169, 97, 0.1);
}
.gw-mail-cta-label {
  margin: 0 0 4px;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #7a6540;
}
.gw-mail-cta a {
  color: #1a4d8c;
  font-size: 0.82rem;
  font-weight: 600;
  word-break: break-all;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.gw-mail-sign {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid rgba(26, 35, 50, 0.12);
}
.gw-mail-sign-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center 22%;
  border: 2px solid rgba(201, 169, 97, 0.55);
  flex-shrink: 0;
}
.gw-mail-sign-text {
  min-width: 0;
}
.gw-mail-sign-name {
  margin: 0;
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1rem;
  font-weight: 700;
  color: #1a2332;
}
.gw-mail-sign-role {
  margin: 2px 0 0;
  font-size: 0.75rem;
  color: #5c6b82;
}
.gw-mail-disclaimer {
  margin: 12px 0 0;
  font-size: 0.72rem;
  color: #7a8499;
  font-style: italic;
}

.gw-mail-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  padding: 12px 16px 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.22);
}
.gw-mail-note {
  flex: 1 1 160px;
  margin: 0;
  font-size: 0.72rem;
  color: var(--mail-muted);
  line-height: 1.35;
}
.gw-mail-foot button {
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: #e8edf8;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 9px 13px;
  cursor: pointer;
}
.gw-mail-foot button:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--mail-accent-border);
}
.gw-mail-foot .gw-mail-primary {
  border-color: var(--mail-accent-border);
  background: var(--mail-accent-soft);
  color: #fff8e8;
}
.gw-mail-to-input {
  width: 100%;
  box-sizing: border-box;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(0, 0, 0, 0.25);
  color: #eef2ff;
  font-family: inherit;
  font-size: 0.84rem;
  padding: 7px 10px;
}
.gw-mail-to-input:focus {
  outline: none;
  border-color: var(--mail-accent-border);
}
.gw-mail-foot .gw-mail-send:not(:disabled) {
  opacity: 1;
  border-color: var(--mail-accent-border);
  background: var(--mail-accent-soft);
  color: #fff8e8;
  cursor: pointer;
}
.gw-mail-foot .gw-mail-send.is-sending {
  opacity: 0.7;
  cursor: wait;
}

@media (max-width: 520px) {
  .gw-mail-brand {
    flex-wrap: wrap;
  }
  .gw-mail-head-actions {
    flex-direction: row;
    width: 100%;
    justify-content: space-between;
  }
  .gw-mail-letter {
    padding: 16px;
  }
}
