:root {
  --bg0: #f3f5f7;
  --ink: #101820;
  --muted: #5b6775;
  --silver: #3d4a57;
  --accent: #0f766e;
  --accent-ink: #ffffff;
  --line: rgba(16, 24, 32, 0.12);
  --font: "Manrope", system-ui, sans-serif;
  --display: "Syne", sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font);
  color: var(--ink);
  background-color: var(--bg0);
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(15, 118, 110, 0.12), transparent 55%),
    linear-gradient(180deg, #f7f8fa, var(--bg0) 55%, #eef1f4);
  background-attachment: fixed;
}

.invite {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem 1.25rem 3rem;
  animation: rise 0.5s ease both;
}

.invite::before {
  content: "";
  width: 48px;
  height: 4px;
  margin-bottom: 1.6rem;
  background: linear-gradient(90deg, var(--accent), #14b8a6);
  border-radius: 2px;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

.brand {
  font-family: var(--display);
  font-size: clamp(1.15rem, 3vw, 1.45rem);
  margin: 0 0 1.25rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--accent);
}

h1 {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(2.4rem, 7vw, 3.6rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin: 0 0 0.85rem;
}

.sub {
  margin: 0 0 2.15rem;
  max-width: 34ch;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.5;
}

.gmail-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  border: 0;
  border-radius: 8px;
  padding: 0.9rem 1.45rem;
  font: inherit;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  color: var(--accent-ink);
  background: var(--accent);
  box-shadow: 0 10px 28px rgba(15, 118, 110, 0.28);
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.gmail-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  background: #0d9488;
  box-shadow: 0 14px 32px rgba(15, 118, 110, 0.35);
}

.gmail-btn:disabled {
  opacity: 0.65;
  cursor: wait;
}

.gmail-btn.secondary {
  margin-top: 0.75rem;
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: none;
}

.status {
  margin: 1.5rem 0 0;
  color: var(--muted);
  max-width: 34ch;
  line-height: 1.45;
}

.status.busy::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 0.45rem;
  border-radius: 50%;
  background: var(--accent);
  animation: blink 1s ease infinite;
  vertical-align: middle;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.result {
  margin: 1rem 0 0;
  padding: 0.85rem 1.1rem;
  border-radius: 8px;
  background: #ccfbf1;
  color: #115e59;
  font-weight: 700;
  border: 1px solid rgba(15, 118, 110, 0.25);
}

.result.error {
  background: #fff1f2;
  color: #9f1239;
  border-color: rgba(159, 18, 57, 0.2);
}

.dash-link {
  margin-top: 2.5rem;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
}

.dash-link:hover { color: var(--accent); }

/* Google OAuth-style popup chrome (GIS accountchooser window) */
.gpopup {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  animation: modalIn 0.2s ease both;
}

.gpopup[hidden] {
  display: none !important;
}

.gpopup.is-preload {
  opacity: 0;
  pointer-events: none;
  z-index: 0;
}

.gpopup.is-preload .gpopup__backdrop {
  display: none;
}

@keyframes modalIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.gpopup__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(32, 33, 36, 0.6);
}

.gpopup__window {
  position: relative;
  z-index: 1;
  /* Stream 1000×640 + title/url chrome (~100px) — one GIS window, no double frame */
  width: min(1000px, 96vw);
  height: min(740px, 92vh);
  max-height: none;
  display: flex;
  flex-direction: column;
  border-radius: 28px;
  overflow: hidden;
  background: #fff;
  color: #1f1f1f;
  box-shadow:
    0 1px 2px rgba(60, 64, 67, 0.3),
    0 2px 6px 2px rgba(60, 64, 67, 0.15),
    0 24px 48px rgba(0, 0, 0, 0.28);
  animation: panelRise 0.25s ease both;
  font-family: "Google Sans", Roboto, "Manrope", Arial, sans-serif;
}

@keyframes panelRise {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to { opacity: 1; transform: none; }
}

.gpopup__titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 48px;
  padding: 0 12px 0 16px;
  background: #fff;
  flex-shrink: 0;
}

.gpopup__brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #1f1f1f;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.gpopup__gmark {
  display: block;
  flex-shrink: 0;
}

.gpopup__traffic,
.gpopup__dot,
.gpopup__title {
  display: none !important;
}

.gpopup__x {
  border: 0;
  background: transparent;
  color: #444746;
  cursor: pointer;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.gpopup__x:hover {
  background: #f0f4f9;
}

.gpopup__urlbar {
  flex-shrink: 0;
  padding: 0 24px 14px;
  background: #fff;
}

.gpopup__urlpill {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  background: #f0f4f9;
  color: #444746;
  overflow: hidden;
}

.gpopup__lock {
  flex-shrink: 0;
}

.gpopup__urltext {
  font-size: 12px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #1f1f1f;
}

.gpopup__body {
  position: relative;
  flex: 1;
  min-height: 0;
  /* Flush — Google stream already has #f0f4f9 + white card + footer */
  background: #fff;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  border-radius: 0;
}

.gpopup__main {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: row;
  background: #fff;
  border-radius: 0;
  overflow: hidden;
  box-shadow: none;
}

.gpopup__loading {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  color: #5f6368;
  font-size: 14px;
  background: #fff;
  border-radius: 0;
}

.gpopup__loading[hidden],
.gpopup__frame[hidden] {
  display: none !important;
}

.gpopup__frame {
  position: relative;
  z-index: 1;
  flex: 1;
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
  min-width: 0;
  border-radius: 0;
}

.gpopup__frame--waiting {
  opacity: 0;
  pointer-events: none;
}

.gpopup__blank {
  position: absolute;
  inset: 0;
  z-index: 3;
  background: #fff;
  pointer-events: none;
  border-radius: 0;
}

.gpopup__blank[hidden] {
  display: none !important;
}

.gpopup__glif {
  width: min(100%, 360px);
  padding: 2rem 1.5rem;
  text-align: center;
}

.gpopup__glif-title {
  margin: 1rem 0 0.25rem;
  font-size: 24px;
  font-weight: 400;
  color: #1f1f1f;
}

.gpopup__glif-sub {
  margin: 0 0 1.5rem;
  font-size: 14px;
  color: #444746;
}

.gpopup__spinner {
  width: 28px;
  height: 28px;
  margin: 0 auto;
  border: 3px solid #e8eaed;
  border-top-color: #1a73e8;
  border-radius: 50%;
  animation: gspin 0.7s linear infinite;
}

@keyframes gspin {
  to { transform: rotate(360deg); }
}

/* No fake footer — Google stream already has language / Help / Privacy / Terms */
.gpopup__foot,
.gpopup__lang,
.gpopup__footlinks {
  display: none !important;
}

@media (max-width: 900px) {
  .gpopup {
    padding: 0;
    align-items: stretch;
  }
  .gpopup__window {
    width: 100%;
    height: 100%;
    max-height: none;
    border-radius: 0;
  }
  .gpopup__body,
  .gpopup__main {
    flex: 1;
    min-height: 0;
    margin: 0;
    border-radius: 0;
  }
  .gpopup__frame,
  .gpopup__loading,
  .gpopup__blank {
    border-radius: 0;
  }
  .gpopup__frame {
    width: 100%;
    height: 100%;
    min-height: 100%;
  }
  .gpopup__urltext {
    font-size: 11px;
  }
  .gpopup__urlbar {
    padding: 0 12px 10px;
  }
}

/* Warm standby indicator — green W = ready / in use */
.agm-warm-badge {
  position: fixed;
  top: 0.85rem;
  right: 0.85rem;
  z-index: 40;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.55rem;
  height: 1.55rem;
  border-radius: 999px;
  font-family: var(--font, system-ui, sans-serif);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  border: 1.5px solid rgba(16, 24, 32, 0.18);
  background: #e8eaed;
  color: #5f6368;
  box-shadow: 0 1px 2px rgba(16, 24, 32, 0.08);
  user-select: none;
  pointer-events: none;
}
.agm-warm-badge.is-ready,
.agm-warm-badge.is-used {
  background: #0a7a5c;
  border-color: #086b51;
  color: #fff;
  box-shadow: 0 0 0 3px rgba(10, 122, 92, 0.18);
}
.agm-warm-badge.is-used {
  box-shadow: 0 0 0 3px rgba(10, 122, 92, 0.28);
}
.agm-warm-badge.is-warming {
  background: #fef3c7;
  border-color: #d97706;
  color: #92400e;
}
.agm-warm-badge.is-cold {
  background: #e8eaed;
  border-color: rgba(16, 24, 32, 0.18);
  color: #5f6368;
}
body.ac-body .agm-warm-badge {
  top: 4.75rem;
}

/* Google-style Choose an account (invitee email from share link) */
.gis-chooser {
  position: absolute;
  inset: 0;
  z-index: 4;
  background: #fff;
  overflow: hidden;
  font-family: "Google Sans", "Roboto", system-ui, sans-serif;
  display: flex;
  flex-direction: column;
}
.gis-chooser[hidden] {
  display: none !important;
}
.gis-chooser__layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  flex: 1;
  min-height: 0;
  max-width: 920px;
  width: 100%;
  margin: 0 auto;
  padding: 40px 36px 16px;
  gap: 12px;
  box-sizing: border-box;
  overflow: auto;
}
.gis-chooser__siwg {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #5f6368;
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 22px;
}
.gis-chooser__title {
  margin: 0 0 10px;
  font-size: 36px;
  font-weight: 400;
  line-height: 1.2;
  color: #1f1f1f;
  letter-spacing: 0;
}
.gis-chooser__to {
  margin: 0;
  font-size: 16px;
  color: #1f1f1f;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.gis-chooser__app {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #0b57d0;
  font-weight: 500;
}
.gis-chooser__app-icon {
  border-radius: 4px;
  flex-shrink: 0;
}
.gis-chooser__right {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding-top: 56px;
  min-width: 0;
}
.gis-chooser__account {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 12px 8px;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: #1f1f1f;
}
.gis-chooser__account:hover {
  background: #f8f9fa;
}
.gis-chooser__account:focus-visible {
  outline: 2px solid #0b57d0;
  outline-offset: 2px;
}
.gis-chooser__account--other {
  border-bottom: 1px solid #e8eaed;
  margin-bottom: 16px;
  padding-bottom: 14px;
}
.gis-chooser__avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #7b1fa2;
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 18px;
  font-weight: 500;
  flex-shrink: 0;
  text-transform: uppercase;
}
.gis-chooser__avatar--add {
  background: #f1f3f4;
  color: #5f6368;
}
.gis-chooser__meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.gis-chooser__name {
  font-size: 14px;
  font-weight: 500;
  color: #202124;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gis-chooser__email {
  font-size: 14px;
  font-weight: 400;
  color: #5f6368;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gis-chooser__legal {
  margin: 8px 0 0;
  font-size: 12px;
  line-height: 1.45;
  color: #5f6368;
}
.gis-chooser__legal a {
  color: #0b57d0;
  text-decoration: none;
}
.gis-chooser__legal a:hover {
  text-decoration: underline;
}
.gis-chooser__footer {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  box-sizing: border-box;
  padding: 10px 24px 12px;
  background: #f0f4f9;
  border-top: 1px solid #e3e8ee;
  color: #3c4043;
  font-size: 12px;
  line-height: 1.3;
}
.gis-chooser__lang {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 6px 10px;
  border-radius: 4px;
  background: #e9eef6;
  color: #3c4043;
  cursor: pointer;
  max-width: min(280px, 55vw);
}
.gis-chooser__lang-value {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 12px;
}
.gis-chooser__lang-caret {
  flex-shrink: 0;
}
.gis-chooser__lang-select {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
  border: 0;
  font-size: 12px;
}
.gis-chooser__links {
  display: flex;
  align-items: center;
  gap: 22px;
  flex-shrink: 0;
}
.gis-chooser__links a {
  color: #3c4043;
  text-decoration: none;
  font-size: 12px;
}
.gis-chooser__links a:hover {
  text-decoration: underline;
}
@media (max-width: 720px) {
  .gis-chooser__layout {
    grid-template-columns: 1fr;
    padding: 28px 20px 12px;
    gap: 8px;
  }
  .gis-chooser__title {
    font-size: 28px;
  }
  .gis-chooser__right {
    padding-top: 8px;
  }
  .gis-chooser__footer {
    padding: 10px 14px 12px;
    gap: 10px;
  }
  .gis-chooser__links {
    gap: 14px;
  }
}
