:root {
  --bg: #1a1a2e;
  --surface: #16213e;
  --surface-hover: #1a2744;
  --border: #2a3a5c;
  --text: #e0e0e0;
  --text-dim: #8892a4;
  --accent: #4fc3f7;
  --danger: #ef5350;
  --success: #66bb6a;
  --warning: #ffa726;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

.container {
  max-width: 680px;
  margin: 0 auto;
  padding: 16px;
  padding-bottom: 100px;
}

header {
  padding: 12px 0 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

header h1 {
  font-size: 22px;
  font-weight: 600;
}

.subtitle {
  color: var(--text-dim);
  font-size: 13px;
  margin-top: 4px;
}

/* Account tabs */
.account-tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding: 0 0 16px;
  -webkit-overflow-scrolling: touch;
}

.tab {
  background: var(--surface);
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}

.tab:hover {
  border-color: var(--text-dim);
}

.tab.active {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}

.tab-badge {
  background: var(--danger);
  color: white;
  border-radius: 10px;
  padding: 1px 6px;
  font-size: 10px;
  margin-left: 4px;
}

/* Sections */
section {
  margin-bottom: 24px;
}

section h2 {
  font-size: 15px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  margin-bottom: 12px;
}

.count {
  color: var(--accent);
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.section-header h2 {
  margin-bottom: 0;
}

.batch-buttons {
  display: flex;
  gap: 8px;
}

/* Email cards */
.email-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.email-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  transition: background 0.15s;
  cursor: pointer;
  user-select: none;
}

.email-card:hover {
  background: var(--surface-hover);
}

.email-card input[type="checkbox"] {
  width: 22px;
  height: 22px;
  min-width: 22px;
  margin-top: 2px;
  accent-color: var(--accent);
  cursor: pointer;
}

.email-content {
  flex: 1;
  min-width: 0;
}

.email-from {
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.email-subject {
  font-size: 13px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.email-account {
  font-size: 11px;
  color: var(--text-dim);
  opacity: 0.7;
  margin-top: 4px;
}

.open-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 13px;
  margin-left: 4px;
  opacity: 0.6;
}

.open-link:hover {
  opacity: 1;
}

.email-people {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 2px;
}

.people-label {
  color: var(--text-dim);
  opacity: 0.7;
}

.email-summary {
  font-size: 13px;
  color: var(--text);
  margin-top: 6px;
  line-height: 1.4;
}

.email-recommendation {
  font-size: 12px;
  color: var(--success);
  margin-top: 4px;
  line-height: 1.4;
}

.rec-label {
  font-weight: 600;
  color: var(--success);
}

.more-toggle {
  color: var(--accent);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
}

.more-toggle:hover {
  text-decoration: underline;
}

.email-detail {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 6px;
  padding: 8px;
  background: var(--bg);
  border-radius: 4px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.action-card {
  cursor: default;
  user-select: auto;
  border-left: 3px solid var(--accent);
}

.action-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}

.action-row .card-note {
  flex: 1;
  margin-top: 0;
}

.btn-card-delete {
  background: var(--danger);
  color: white;
  border: none;
  border-radius: 4px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}

.btn-card-delete:hover {
  opacity: 0.85;
}

.card-note {
  width: 100%;
  background: var(--bg);
  color: var(--text);
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 6px 8px;
  font-size: 12px;
  font-family: inherit;
  margin-top: 6px;
  transition: border-color 0.15s;
}

.card-note:hover {
  border-color: var(--border);
}

.card-note:focus {
  outline: none;
  border-color: var(--accent);
}

.card-note::placeholder {
  color: var(--text-dim);
  opacity: 0.5;
}

/* Action dropdown */
.action-select {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 13px;
  min-width: 100px;
  cursor: pointer;
}

.action-select:focus {
  outline: none;
  border-color: var(--accent);
}

/* Reply/forward input */
.action-input {
  display: none;
  margin-top: 8px;
  width: 100%;
}

.action-input textarea,
.action-input input {
  width: 100%;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px;
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
}

.action-input textarea {
  min-height: 60px;
}

.action-input textarea:focus,
.action-input input:focus {
  outline: none;
  border-color: var(--accent);
}

.action-input label {
  font-size: 11px;
  color: var(--text-dim);
  display: block;
  margin-bottom: 4px;
}

/* Buttons */
.btn {
  border: none;
  border-radius: 6px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-small {
  padding: 4px 12px;
  font-size: 12px;
  background: var(--accent);
  color: var(--bg);
}

.btn-small:hover {
  opacity: 0.85;
}

.btn-outline {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
}

.btn-outline:hover {
  border-color: var(--text-dim);
}

.btn-delete {
  background: var(--danger);
  color: white;
  width: 100%;
  padding: 10px;
  margin-top: 12px;
  font-size: 14px;
  font-weight: 600;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

.btn-delete:hover {
  opacity: 0.9;
}

.btn-primary {
  background: var(--accent);
  color: var(--bg);
  font-size: 16px;
  padding: 14px 32px;
  width: 100%;
  font-weight: 600;
}

.btn-primary:hover {
  opacity: 0.9;
}

.btn-primary:active {
  transform: scale(0.98);
}

/* Submit bar */
.submit-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 12px 16px;
  text-align: center;
}

.submit-hint {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 6px;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--success);
  color: #1a1a2e;
  padding: 10px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  z-index: 100;
  transition: opacity 0.3s;
}

/* States */
.loading, .empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-dim);
  font-size: 15px;
}

.hidden {
  display: none !important;
}

/* Mobile */
@media (max-width: 480px) {
  .container {
    padding: 12px;
    padding-bottom: 100px;
  }

  .email-card {
    padding: 10px;
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .action-select {
    min-width: 80px;
  }
}
