/* Amy Inbox — mobile-first, executive, calm */

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

:root {
  --bg:        #f9f8f6;
  --card-bg:   #ffffff;
  --text:      #1a1a18;
  --muted:     #6b6b65;
  --border:    #e8e6e0;
  --primary:   #1a1a18;
  --secondary: #f3f1ec;
  --approve:   #0d7c5a;
  --approve-h: #0a5f47;
  --danger:    #c0392b;
  --radius:    12px;
  --shadow:    0 2px 12px rgba(0,0,0,0.06);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* Header */
.inbox-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-brand {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.header-actions {
  display: flex;
  gap: 12px;
}

.btn-icon {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  color: var(--muted);
  text-decoration: none;
  transition: background 0.15s;
}
.btn-icon:hover { background: var(--secondary); }

/* Main */
.inbox-main {
  flex: 1;
  padding: 24px 20px;
  max-width: 560px;
  margin: 0 auto;
  width: 100%;
}

/* Empty state */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 64px 20px;
  gap: 12px;
}

.empty-check {
  font-size: 32px;
  color: #0d7c5a;
  background: #e6f5ef;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}

/* Legacy icon alias */
.empty-icon {
  font-size: 48px;
  color: #0d7c5a;
  background: #e6f5ef;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}

.empty-state h2 {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.3px;
}

.empty-state p {
  color: var(--muted);
  font-size: 15px;
}

/* Email card */
.email-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  overflow: hidden;
  margin-bottom: 20px;
}

.card-header {
  padding: 20px 20px 0;
}

.sender-info {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.sender-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #1a1a18;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 600;
  flex-shrink: 0;
}

.sender-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sender-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.sender-email {
  font-size: 12px;
  color: var(--muted);
}

.email-subject {
  font-size: 13px;
  color: var(--muted);
  padding: 8px 0 14px;
  border-bottom: 1px solid var(--border);
  font-weight: 500;
}

.card-snippet {
  padding: 16px 20px;
  font-size: 14px;
  line-height: 1.6;
  color: #3d3d3a;
  border-bottom: 1px solid var(--border);
  max-height: 120px;
  overflow: hidden;
}

/* Draft section */
.draft-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  color: var(--muted);
  font-size: 13px;
}

/* Typing indicator — three bouncing dots */
.typing-dots {
  display: flex;
  gap: 4px;
  align-items: center;
}
.typing-dots span {
  display: block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #0d7c5a;
  animation: typingBounce 1.2s infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.18s; }
.typing-dots span:nth-child(3) { animation-delay: 0.36s; }
@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30%            { transform: translateY(-5px); opacity: 1; }
}

/* Legacy single dot — kept for compat */
.loading-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #0d7c5a;
  animation: pulse 1.2s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}

.draft-section {
  padding: 16px 20px;
}

.draft-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #0d7c5a;
  margin-bottom: 10px;
}

.draft-body {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text);
  white-space: pre-wrap;
}

.edit-area textarea {
  width: 100%;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.7;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  resize: vertical;
  min-height: 120px;
  background: #fafaf9;
}

/* Action bar */
.action-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 16px;
}

.btn-primary {
  background: var(--approve);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 14px 24px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  flex: 1;
}
.btn-primary:hover { background: var(--approve-h); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.btn-secondary {
  background: var(--card-bg);
  color: var(--text);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 14px 20px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-secondary:hover { background: var(--secondary); }

.btn-ghost {
  background: none;
  color: var(--muted);
  border: none;
  padding: 14px 16px;
  font-size: 14px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.btn-ghost:hover { color: var(--text); }

/* Queue count */
.queue-count {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  margin-top: 8px;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  background: #1a1a18;
  color: #fff;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  z-index: 100;
  animation: toastIn 0.2s ease;
  white-space: nowrap;
}

.toast-error { background: #c0392b; }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(8px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* Sent overlay — fullscreen "Sent." confirmation */
.sent-overlay {
  position: fixed;
  inset: 0;
  background: rgba(249, 248, 246, 0.92);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  animation: fadeIn 0.2s ease;
}
.sent-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.sent-check {
  font-size: 36px;
  color: #fff;
  background: #0d7c5a;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: popIn 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.sent-label {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text);
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes popIn {
  from { transform: scale(0.6); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

@media (max-width: 480px) {
  .action-bar { flex-wrap: wrap; }
  .btn-primary, .btn-secondary { flex: 1 1 calc(50% - 5px); }
  .btn-ghost { flex: 0 0 100%; order: 3; text-align: center; margin-top: 4px; }
}