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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f5f5f5;
  color: #202124;
  -webkit-font-smoothing: antialiased;
}

.app {
  max-width: 900px;
  margin: 0 auto;
  min-height: 100vh;
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: #1a73e8;
  color: white;
  position: sticky;
  top: 0;
  z-index: 10;
}

.top-bar h1 { font-size: 20px; font-weight: 500; }
.user-info { font-size: 14px; opacity: 0.9; }
.notif-status { margin-right: 6px; }

.content { padding: 0; }

/* Login */
.login-page {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
}

.login-card {
  text-align: center;
  background: white;
  padding: 48px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.login-card h1 { font-size: 32px; color: #1a73e8; margin-bottom: 8px; }
.login-card p { color: #5f6368; margin-bottom: 24px; }

.google-btn {
  display: inline-block;
  padding: 12px 24px;
  background: #1a73e8;
  color: white;
  border-radius: 6px;
  text-decoration: none;
  font-size: 16px;
  font-weight: 500;
  transition: background 0.2s;
}

.google-btn:hover { background: #1557b0; }

/* Auth error banner */
.auth-error-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fff3cd;
  border-bottom: 1px solid #ffc107;
  padding: 10px 16px;
  font-size: 13px;
  gap: 12px;
}

.reauth-btn {
  background: #1a73e8;
  color: white;
  padding: 6px 14px;
  border-radius: 6px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}

/* Email list */
.email-list { background: white; }

.email-row {
  padding: 12px 16px;
  border-bottom: 1px solid #e8eaed;
  cursor: pointer;
  transition: background 0.15s;
}

@media (hover: hover) {
  .email-row:hover { background: #f1f3f4; }
}
.email-row:active { background: #f1f3f4; }
.email-row.unread .email-from,
.email-row.unread .email-subject { font-weight: 600; }

.email-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 4px;
}

.email-from {
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

.email-account {
  font-size: 11px;
  color: #1a73e8;
  background: #e8f0fe;
  padding: 1px 6px;
  border-radius: 3px;
  margin-left: 8px;
  white-space: nowrap;
  flex-shrink: 0;
}

.email-date {
  font-size: 12px;
  color: #5f6368;
  white-space: nowrap;
  flex-shrink: 0;
  margin-left: 8px;
}

.email-subject {
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 2px;
}

.email-snippet {
  font-size: 12px;
  color: #5f6368;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sync-btn {
  display: block;
  width: calc(100% - 32px);
  margin: 16px auto;
  padding: 12px;
  background: #1a73e8;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
}

.sync-btn:active { background: #1557b0; }

.load-more {
  display: block;
  width: 100%;
  padding: 16px;
  background: white;
  border: none;
  border-top: 1px solid #e8eaed;
  color: #1a73e8;
  font-size: 14px;
  cursor: pointer;
}

.load-more:hover { background: #f1f3f4; }

/* Email detail */
.email-detail {
  background: #f5f5f5;
  min-height: calc(100vh - 56px);
}

.detail-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 12px 16px;
  background: white;
  border-bottom: 1px solid #e8eaed;
}

.back-btn {
  background: none;
  border: none;
  color: #1a73e8;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  padding: 6px 0;
}

.archive-btn {
  padding: 8px 16px;
  background: #e8f0fe;
  color: #1a73e8;
  border: none;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}

.archive-btn:active { background: #d2e3fc; }

.detail-header {
  background: white;
  padding: 20px 16px 16px;
  margin-bottom: 1px;
}

.email-detail-subject {
  font-size: 20px;
  font-weight: 400;
  margin-bottom: 16px;
  line-height: 1.35;
  color: #202124;
}

.email-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 13px;
  color: #5f6368;
}

.email-meta span {
  line-height: 1.5;
}

.email-body {
  background: white;
  padding: 16px;
  margin-top: 8px;
  font-size: 14px;
  line-height: 1.6;
  border-radius: 0;
}

.email-body pre {
  white-space: pre-wrap;
  font-family: inherit;
}

.email-iframe {
  width: 100%;
  border: none;
  background: #fff;
  overflow: hidden;
  border-radius: 8px;
}

.notif-btn {
  background: rgba(255,255,255,0.2);
  border: 1px solid rgba(255,255,255,0.4);
  color: white;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  margin-right: 8px;
}
