/* === APP SHELL === */
.app-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
}

.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 2rem;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 2rem;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--fg);
  font-weight: 700;
  font-size: 1rem;
  font-family: var(--font-heading);
  flex-shrink: 0;
}

.nav-logo {
  width: 28px;
  height: 28px;
  background: var(--accent);
  color: var(--bg);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.nav-links {
  display: flex;
  gap: 0.25rem;
  flex: 1;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 14px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--fg-muted);
  font-size: 0.875rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

.nav-link:hover { background: rgba(255,255,255,0.05); color: var(--fg); }
.nav-link.active { background: rgba(212,160,84,0.12); color: var(--accent); }

.nav-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-left: auto;
}

.nav-email {
  font-size: 0.8rem;
  color: var(--fg-dim);
  font-family: var(--font-mono);
}

/* === BUTTONS === */
.btn-primary, .btn-secondary, .btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  transition: all 0.15s;
  border: none;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: var(--bg);
}
.btn-primary:hover { background: var(--accent-bright); }

.btn-secondary {
  background: var(--bg-card);
  color: var(--fg-muted);
  border: 1px solid var(--border);
}
.btn-secondary:hover { color: var(--fg); border-color: rgba(255,255,255,0.15); }

.btn-ghost {
  background: transparent;
  color: var(--fg-dim);
  padding: 6px 10px;
}
.btn-ghost:hover { color: var(--fg); }

button:disabled { opacity: 0.5; cursor: not-allowed; }

/* === APP LAYOUT === */
.app-main { padding: 2rem 0 4rem; min-height: calc(100vh - 56px); }

.app-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 2rem;
}

/* === PAGE HEADER === */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.page-title {
  font-family: var(--font-heading);
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--fg);
  margin-bottom: 0.25rem;
}

.header-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-shrink: 0;
}

/* === STATS ROW === */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.stat-card.urgent { border-color: rgba(239, 68, 68, 0.2); }
.stat-card.action { border-color: rgba(234, 179, 8, 0.2); }

.stat-card-num {
  font-family: var(--font-mono);
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--fg);
  line-height: 1;
}

.stat-card.urgent .stat-card-num { color: #ef4444; }
.stat-card.action .stat-card-num { color: #eab308; }
.stat-card.total .stat-card-num { color: var(--accent); }

.stat-card-label {
  font-size: 0.75rem;
  color: var(--fg-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* === BRIEFING CARD === */
.briefing-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem 2.5rem;
  margin-bottom: 2rem;
}

.briefing-content {
  line-height: 1.75;
  color: var(--fg);
  font-size: 0.95rem;
}

/* Markdown-rendered briefing styles */
.briefing-content h2 {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.02em;
  margin: 1.75rem 0 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.briefing-content h2:first-child { margin-top: 0; }

.briefing-content ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.briefing-content li {
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  padding-left: 1rem;
  position: relative;
  color: var(--fg-muted);
}

.briefing-content li::before {
  content: '·';
  position: absolute;
  left: 0;
  color: var(--accent);
  font-weight: 700;
}

.briefing-content strong { color: var(--fg); font-weight: 600; }
.briefing-content p { color: var(--fg-muted); margin-bottom: 0.5rem; }

/* === HISTORY === */
.history-row { margin-top: 2rem; }

.history-title {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-dim);
  margin-bottom: 0.75rem;
  font-family: var(--font-mono);
}

.history-list { display: flex; flex-direction: column; gap: 0.5rem; }

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.history-date {
  font-size: 0.875rem;
  color: var(--fg-muted);
}

.history-stats { display: flex; gap: 0.5rem; }

/* === BADGES === */
.badge {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 0.7rem;
  font-weight: 600;
  font-family: var(--font-mono);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.badge-urgent, .urgent-badge { background: rgba(239,68,68,0.15); color: #ef4444; }
.badge-action_needed, .action-badge { background: rgba(234,179,8,0.12); color: #eab308; }
.badge-fyi, .fyi-badge { background: rgba(212,160,84,0.12); color: var(--accent); }
.badge-archive { background: rgba(255,255,255,0.05); color: var(--fg-dim); }

/* === EMAIL LIST === */
.filter-tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 1.5rem;
  padding: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  width: fit-content;
}

.filter-tab {
  padding: 6px 14px;
  border-radius: 7px;
  font-size: 0.825rem;
  font-weight: 500;
  color: var(--fg-muted);
  text-decoration: none;
  transition: all 0.15s;
}

.filter-tab:hover { background: rgba(255,255,255,0.04); color: var(--fg); }
.filter-tab.active { background: var(--bg-elevated); color: var(--fg); box-shadow: 0 1px 3px rgba(0,0,0,0.3); }

.email-list { display: flex; flex-direction: column; gap: 0; }

.email-row {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}

.email-row:hover { background: rgba(255,255,255,0.02); }
.email-row:first-child { border-top: 1px solid var(--border); }

.email-priority-bar {
  width: 3px;
  flex-shrink: 0;
  background: var(--border);
  border-radius: 0;
}

.email-row.priority-urgent .email-priority-bar { background: #ef4444; }
.email-row.priority-action_needed .email-priority-bar { background: #eab308; }
.email-row.priority-fyi .email-priority-bar { background: var(--accent); }

.email-content {
  flex: 1;
  padding: 1rem 1.25rem;
}

.email-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.25rem;
}

.email-sender {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--fg);
}

.email-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.email-time {
  font-size: 0.75rem;
  color: var(--fg-dim);
  font-family: var(--font-mono);
}

.email-subject {
  font-size: 0.875rem;
  color: var(--fg-muted);
  margin-bottom: 0.25rem;
}

.email-subject.unread {
  font-weight: 600;
  color: var(--fg);
}

.email-snippet {
  font-size: 0.8rem;
  color: var(--fg-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.email-ai-summary {
  font-size: 0.8rem;
  color: var(--accent);
  font-style: italic;
}

/* === EMPTY STATE === */
.empty-state {
  text-align: center;
  padding: 6rem 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.empty-icon { font-size: 3rem; margin-bottom: 0.5rem; }
.empty-state h2 { font-family: var(--font-heading); font-size: 1.5rem; color: var(--fg); }
.empty-state p { color: var(--fg-muted); max-width: 360px; }

/* === RESPONSIVE === */
@media (max-width: 768px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .nav-email { display: none; }
  .page-header { flex-direction: column; }
  .header-actions { width: 100%; }
  .briefing-card { padding: 1.5rem; }
}
