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

:root {
  --primary: #000000;
  --primary-dark: #1a1a1a;
  --bg: #f5f4ff;
  --card: #ffffff;
  --text: #000000;
  --muted: #000000;
  --border: #e2e8f0;
  --success-bg: #f0fdf4;
  --success-border: #bbf7d0;
  --success-text: #166534;
  --error-bg: #fef2f2;
  --error-border: #fecaca;
  --error-text: #991b1b;
  --radius: 14px;
  --shadow: 0 2px 20px rgba(79, 70, 229, 0.08);
}

body {
  font-weight: 700;
  font-family: 'Consolas', 'Menlo', 'Monaco', 'Courier New', monospace;
  background-color: #ffffff;
  background-image: radial-gradient(circle, #d1d5db 1px, transparent 1px);
  background-size: 24px 24px;
  color: var(--text);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ── Wordmark ─────────────────────────────────────────────────────────────── */

.wordmark,
.header-wordmark {
  font-weight: 800;
  letter-spacing: -0.06em;
  background: #000000;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.wordmark { font-size: 2rem; display: block; margin-bottom: 16px; }
.header-wordmark { font-size: 1.15rem; }

/* ── Code gate ────────────────────────────────────────────────────────────── */

#code-gate {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: 32px 20px;
}

.code-gate-inner {
  text-align: center;
  width: 100%;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.code-gate-subtitle {
  font-size: 0.9rem;
  color: #000;
}

.code-gate-input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  font-size: 1rem;
  font-family: 'Consolas', 'Menlo', 'Monaco', 'Courier New', monospace;
  font-weight: 700;
  text-align: center;
  color: #000;
  background: #fff;
  outline: none;
  letter-spacing: 0.05em;
}

.code-gate-input:focus { border-color: #000; }

.code-gate-btn {
  width: 100%;
  padding: 14px 0;
  background: #000;
  color: #fff;
  border: none;
  border-radius: 50px;
  font-size: 0.95rem;
  font-family: 'Consolas', 'Menlo', 'Monaco', 'Courier New', monospace;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s;
}

.code-gate-btn:hover   { opacity: 0.85; }
.code-gate-btn:disabled { opacity: 0.45; cursor: default; }

.code-gate-error {
  font-size: 0.8rem;
  color: #991b1b;
}

/* ── Landing ──────────────────────────────────────────────────────────────── */

#landing {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: 32px 20px;
}

.landing-inner {
  text-align: center;
  width: fit-content;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.landing-subline {
  font-size: 0.95rem;
  color: #000000;
}

.nowrap {
  white-space: nowrap;
}

.divider {
  border: none;
  border-top: 1px solid var(--border);
  width: 100%;
  margin: 24px 0;
}

.tagline {
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.25;
  color: var(--text);
}

.demo-row {
  display: flex;
  gap: 16px;
  justify-content: center;
  align-items: stretch;
}

.demo-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  text-align: center;
  box-shadow: var(--shadow);
  width: 285px;
}

.demo-in {
  font-size: 0.92rem;
  color: var(--muted);
  line-height: 1.5;
  white-space: nowrap;
}

.demo-arrow {
  text-align: center;
  font-size: 1.1rem;
  color: var(--muted);
  margin: 12px 0;
}

.demo-out {
  font-size: 0.75rem;
  color: #9ca3af;
  text-align: center;
  white-space: nowrap;
}

.btn-connect {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  color: var(--text);
  border: 2px solid var(--border);
  padding: 15px 30px;
  border-radius: 50px;
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
}

.btn-connect:hover {
  border-color: #4285F4;
  box-shadow: 0 4px 20px rgba(66,133,244,0.18);
  transform: translateY(-1px);
}

.btn-connect:active { transform: translateY(0); }

.fine-print {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 16px;
}

/* ── App ──────────────────────────────────────────────────────────────────── */

#app {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}

.header-email {
  font-size: 0.82rem;
  color: var(--muted);
  margin-left: auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 200px;
}

/* ── Account switcher ─────────────────────────────────────────────────────── */

.account-switcher {
  position: relative;
  margin-left: auto;
}

.account-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-family: inherit;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 8px;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: background 0.1s, color 0.1s;
}
.account-chip:hover { background: #f8fafc; color: #000; }
.account-chip:empty { display: none; }
.account-chip::after {
  content: '▾';
  font-size: 0.6rem;
  flex-shrink: 0;
  opacity: 0.6;
}

.account-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 280px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  z-index: 100;
  overflow: hidden;
}

.account-list { max-height: 220px; overflow-y: auto; }

.account-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  transition: background 0.1s;
}
.account-item:hover    { background: #f8fafc; }
.account-item.active   { background: #f0fdf4; }

.account-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.account-name {
  font-size: 0.8rem;
  font-weight: 700;
  font-family: 'Courier New', monospace;
  color: #000;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 5px;
}

.account-item.active .account-name::before {
  content: '✓';
  color: #16a34a;
  font-size: 0.75rem;
}

.account-email {
  font-size: 0.7rem;
  color: #94a3b8;
  font-family: 'Courier New', monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.account-remove {
  background: none;
  border: none;
  color: #cbd5e1;
  cursor: pointer;
  font-size: 0.75rem;
  padding: 4px 7px;
  border-radius: 6px;
  flex-shrink: 0;
  transition: background 0.1s, color 0.1s;
}
.account-remove:hover { color: #dc2626; background: #fef2f2; }

.account-add-btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: 11px 14px;
  border: none;
  border-top: 1px solid #e2e8f0;
  background: #f8fafc;
  font-size: 0.76rem;
  font-weight: 700;
  font-family: 'Courier New', monospace;
  color: #000;
  cursor: pointer;
  transition: background 0.1s;
}
.account-add-btn:hover { background: #f0fdf4; }

.header-disconnect {
  font-size: 0.82rem;
  color: var(--muted);
  text-decoration: none;
  flex-shrink: 0;
}
.header-disconnect:hover { color: #dc2626; }

main {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 32px 16px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  width: 100%;
  max-width: 560px;
  box-shadow: var(--shadow);
}

.card-description {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 8px;
  text-align: center;
}

.card-examples {
  font-size: 0.75rem;
  color: #9ca3af;
  text-align: center;
  margin-bottom: 20px;
}

.auto-send-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  cursor: pointer;
}

.auto-send-row input[type="checkbox"] {
  width: 15px;
  height: 15px;
  cursor: pointer;
  accent-color: #000;
}

.auto-send-label {
  font-size: 0.78rem;
  font-weight: 700;
  font-family: 'Courier New', monospace;
  color: #000;
  user-select: none;
}

.btn-row {
  display: flex;
  justify-content: center;
  margin-top: 12px;
}

/* ── Calendar selector ────────────────────────────────────────────────────── */

.color-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
  align-items: center;
}

.color-swatch {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.1s, border-color 0.1s;
  padding: 0;
}

.color-swatch:hover { transform: scale(1.2); }

.color-swatch.selected { border-color: #000; transform: scale(1.2); }

.color-none {
  background: #fff;
  border: 2px solid #e2e8f0;
  position: relative;
}

.color-none::after {
  content: '✕';
  font-size: 10px;
  color: #94a3b8;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.color-none.selected { border-color: #000; }

.contact-toggles {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  position: relative;
}

.contact-source-wrap {
  position: relative;
}

.contact-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  width: 280px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  z-index: 100;
  overflow: hidden;
}

.contact-search {
  width: 100%;
  padding: 10px 14px;
  border: none;
  border-bottom: 1px solid #e2e8f0;
  font-size: 0.8rem;
  font-family: 'Courier New', monospace;
  font-weight: 700;
  outline: none;
  background: #f8fafc;
}

.contact-list {
  max-height: 220px;
  overflow-y: auto;
}

.contact-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  transition: background 0.1s;
}

.contact-item:hover   { background: #f8fafc; }
.contact-item.selected { background: #f0fdf4; }

.contact-check {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 1.5px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  flex-shrink: 0;
  color: #000;
}

.contact-item.selected .contact-check {
  background: #000;
  border-color: #000;
  color: #fff;
}

.contact-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.contact-name {
  font-size: 0.8rem;
  font-weight: 700;
  font-family: 'Courier New', monospace;
  color: #000;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.contact-email {
  font-size: 0.7rem;
  color: #94a3b8;
  font-family: 'Courier New', monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.contact-empty {
  padding: 14px;
  font-size: 0.78rem;
  color: #94a3b8;
  font-family: 'Courier New', monospace;
  text-align: center;
}

.contact-chip {
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 5px 14px;
  font-size: 0.75rem;
  font-weight: 700;
  font-family: 'Courier New', monospace;
  background: #fff;
  color: #000;
  cursor: pointer;
  transition: all 0.15s;
}

.contact-chip.active,
.contact-chip:hover {
  border-color: #000;
  background: #000;
  color: #fff;
}

.cal-selector {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.cal-label {
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.cal-select {
  flex: 1;
  padding: 8px 12px;
  border: 2px solid var(--border);
  border-radius: 10px;
  font-size: 0.85rem;
  font-family: inherit;
  font-weight: 700;
  color: var(--text);
  background: var(--card);
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

.cal-select:focus { border-color: var(--primary); }

/* ── Input row ────────────────────────────────────────────────────────────── */

.input-row {
  display: flex;
  gap: 10px;
}

#entry-input {
  flex: 1;
  min-width: 0;
  padding: 14px 16px;
  border: 2px solid var(--border);
  border-radius: 10px;
  font-size: 1rem;
  font-family: inherit;
  color: var(--text);
  background: var(--card);
  outline: none;
  transition: border-color 0.15s;
  text-align: center;
}

#entry-input::placeholder { color: #94a3b8; }
#entry-input:focus { border-color: var(--primary); }

#submit-btn {
  padding: 12px 36px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, transform 0.1s;
}

#submit-btn:hover:not(:disabled) { background: var(--primary-dark); }
#submit-btn:active:not(:disabled) { transform: scale(0.97); }
#submit-btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* ── Chips ────────────────────────────────────────────────────────────────── */

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.chip {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 6px 13px;
  font-size: 0.8rem;
  color: var(--muted);
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.12s, color 0.12s, background 0.12s;
}

.chip:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(79, 70, 229, 0.05);
}

/* ── Mic button ───────────────────────────────────────────────────────────── */

.mic-btn {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: 10px;
  border: 2px solid var(--border);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  padding: 0;
}

.mic-btn:hover {
  border-color: var(--primary);
}

.mic-btn.listening {
  border-color: #dc2626;
  background: #fef2f2;
  color: #dc2626;
  animation: mic-pulse 1s ease-in-out infinite;
}

@keyframes mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.25); }
  50%       { box-shadow: 0 0 0 6px rgba(220, 38, 38, 0); }
}

/* ── Loading ──────────────────────────────────────────────────────────────── */

.loading {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
  color: var(--muted);
  font-size: 0.9rem;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
  flex-shrink: 0;
}

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

/* ── Result ───────────────────────────────────────────────────────────────── */

.result {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 10px;
  background: var(--success-bg);
  border: 1px solid var(--success-border);
  animation: fadeIn 0.2s ease;
}

.result.is-error {
  background: var(--error-bg);
  border-color: var(--error-border);
}

.result-icon {
  font-size: 1.1rem;
  line-height: 1.5;
  flex-shrink: 0;
}

#result-text {
  font-size: 0.93rem;
  line-height: 1.55;
  color: var(--text);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Mobile ───────────────────────────────────────────────────────────────── */

@media (max-width: 480px) {
  .tagline { font-size: 1.35rem; }
  .card { padding: 18px 16px; }
  #entry-input { font-size: 0.95rem; padding: 13px 14px; }
  #submit-btn  { font-size: 0.95rem; padding: 13px 18px; }
  .header-email { display: none; }
  .account-chip { max-width: 130px; }
  .account-dropdown { width: 240px; }
}
