/* === EMAIL INBOX — Full Email Management View === */

.einbox {
  position: fixed;
  inset: 0;
  z-index: 400;
  background: #08080f;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.einbox.hidden { display: none; }

/* --- Header --- */
.einbox-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid rgba(212, 175, 55, 0.15);
  background: rgba(12, 12, 18, 0.95);
  flex-shrink: 0;
}

.einbox-back {
  background: transparent;
  border: 1px solid rgba(212, 175, 55, 0.2);
  color: #d4af37;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.einbox-back:hover { border-color: #d4af37; background: rgba(212,175,55,0.08); }

.einbox-account-label {
  font-size: 13px;
  font-weight: 700;
  color: #e8c07a;
  letter-spacing: 0.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

.einbox-search-wrap {
  flex: 1;
  display: flex;
  gap: 0;
  max-width: 400px;
}

.einbox-search {
  flex: 1;
  background: rgba(20, 20, 28, 0.9);
  border: 1px solid rgba(212, 175, 55, 0.15);
  border-right: none;
  color: #e8e8ec;
  padding: 7px 12px;
  border-radius: 6px 0 0 6px;
  font-size: 12px;
  outline: none;
}
.einbox-search:focus { border-color: rgba(212,175,55,0.4); }
.einbox-search::placeholder { color: #4a4a5a; }

.einbox-search-btn {
  background: rgba(212, 175, 55, 0.1);
  border: 1px solid rgba(212, 175, 55, 0.15);
  color: #d4af37;
  padding: 7px 10px;
  border-radius: 0 6px 6px 0;
  cursor: pointer;
  font-size: 14px;
}

.einbox-compose-btn {
  background: rgba(212, 175, 55, 0.15);
  border: 1px solid rgba(212, 175, 55, 0.3);
  color: #d4af37;
  padding: 6px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
  white-space: nowrap;
}
.einbox-compose-btn:hover { background: rgba(212,175,55,0.25); border-color: #d4af37; }

/* --- Tabs --- */
.einbox-tabs {
  display: flex;
  gap: 2px;
  padding: 0 16px;
  border-bottom: 1px solid rgba(212, 175, 55, 0.1);
  background: rgba(12, 12, 18, 0.8);
  flex-shrink: 0;
  overflow-x: auto;
}

.einbox-tab {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: #5a5a65;
  padding: 10px 16px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  white-space: nowrap;
  transition: all 0.15s ease;
}
.einbox-tab:hover { color: #e8c07a; }
.einbox-tab.active {
  color: #d4af37;
  border-bottom-color: #d4af37;
}

/* --- Bulk Bar --- */
.einbox-bulk-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  background: rgba(212, 175, 55, 0.08);
  border-bottom: 1px solid rgba(212, 175, 55, 0.15);
  flex-shrink: 0;
}
.einbox-bulk-bar.hidden { display: none; }

.einbox-bulk-label {
  font-size: 12px;
  font-weight: 700;
  color: #d4af37;
  margin-right: auto;
}

.einbox-bulk-btn {
  background: rgba(212, 175, 55, 0.12);
  border: 1px solid rgba(212, 175, 55, 0.25);
  color: #d4af37;
  padding: 5px 14px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
}
.einbox-bulk-btn:hover { background: rgba(212,175,55,0.25); }
.einbox-bulk-btn.danger { color: #ef4444; border-color: rgba(239,68,68,0.3); background: rgba(239,68,68,0.08); }
.einbox-bulk-btn.danger:hover { background: rgba(239,68,68,0.2); }

/* --- Split Pane --- */
.einbox-split {
  flex: 1;
  display: flex;
  min-height: 0;
  overflow: hidden;
}

/* --- List Pane --- */
.einbox-list {
  width: 45%;
  min-width: 300px;
  max-width: 500px;
  overflow-y: auto;
  border-right: 1px solid rgba(212, 175, 55, 0.1);
  flex-shrink: 0;
}

.einbox-list::-webkit-scrollbar { width: 4px; }
.einbox-list::-webkit-scrollbar-track { background: transparent; }
.einbox-list::-webkit-scrollbar-thumb { background: rgba(212,175,55,0.15); border-radius: 2px; }

/* --- Email Row --- */
.einbox-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  cursor: pointer;
  transition: background 0.1s ease;
  position: relative;
}
.einbox-row:hover { background: rgba(212,175,55,0.04); }
.einbox-row.selected { background: rgba(212,175,55,0.08); }
.einbox-row.unread { border-left: 3px solid #d4af37; }
.einbox-row.has-draft { border-left: 3px solid #eab308; }

.einbox-cb {
  margin-top: 4px;
  accent-color: #d4af37;
  cursor: pointer;
  flex-shrink: 0;
}

.einbox-row-content {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

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

.einbox-sender {
  font-size: 13px;
  font-weight: 700;
  color: #e8e8ec;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.einbox-row.unread .einbox-sender { color: #fff; }

.einbox-cat-badge {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 1px 6px;
  border-radius: 3px;
  border: 1px solid;
  white-space: nowrap;
  flex-shrink: 0;
}

.einbox-time {
  font-size: 11px;
  color: #5a5a65;
  margin-left: auto;
  white-space: nowrap;
  flex-shrink: 0;
}

.einbox-subject {
  font-size: 12px;
  color: #c8c8cc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}
.einbox-row.unread .einbox-subject { color: #e8e8ec; font-weight: 600; }

.einbox-snippet {
  font-size: 11px;
  color: #6a6a75;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.einbox-confidence {
  font-size: 10px;
  color: #5a5a65;
  margin-top: 3px;
  font-style: italic;
}

.einbox-urgency {
  font-weight: 700;
  font-style: normal;
  font-size: 9px;
  letter-spacing: 0.5px;
}

/* Quick actions (appear on hover) */
.einbox-row-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.15s ease;
  flex-shrink: 0;
  padding-top: 2px;
}
.einbox-row:hover .einbox-row-actions { opacity: 1; }

.einbox-action-icon {
  background: transparent;
  border: 1px solid rgba(212,175,55,0.1);
  color: #7a7a8a;
  width: 26px;
  height: 26px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.einbox-action-icon:hover { color: #d4af37; border-color: rgba(212,175,55,0.3); background: rgba(212,175,55,0.06); }

/* --- Preview Pane --- */
.einbox-preview {
  flex: 1;
  overflow-y: auto;
  padding: 0;
  min-width: 0;
}

.einbox-preview::-webkit-scrollbar { width: 4px; }
.einbox-preview::-webkit-scrollbar-track { background: transparent; }
.einbox-preview::-webkit-scrollbar-thumb { background: rgba(212,175,55,0.15); border-radius: 2px; }

.einbox-preview-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #4a4a5a;
  font-size: 14px;
  font-style: italic;
}

.einbox-prev-header {
  padding: 20px 24px;
  border-bottom: 1px solid rgba(212,175,55,0.08);
  background: rgba(12,12,18,0.5);
}

.einbox-prev-subject {
  font-size: 18px;
  font-weight: 700;
  color: #e8e8ec;
  margin: 0 0 12px;
  line-height: 1.3;
}

.einbox-prev-meta {
  font-size: 12px;
  color: #8a8a95;
  line-height: 1.6;
}
.einbox-prev-meta strong { color: #a8a8b5; }

.einbox-prev-class {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.einbox-urgency-badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 2px 8px;
  border-radius: 3px;
}

.einbox-prev-summary {
  font-size: 12px;
  color: #8a8a95;
  font-style: italic;
}

.einbox-prev-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.einbox-prev-action-btn {
  background: rgba(212, 175, 55, 0.1);
  border: 1px solid rgba(212, 175, 55, 0.2);
  color: #d4af37;
  padding: 6px 16px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
}
.einbox-prev-action-btn:hover { background: rgba(212,175,55,0.2); border-color: #d4af37; }
.einbox-prev-action-btn.danger { color: #ef4444; border-color: rgba(239,68,68,0.2); background: rgba(239,68,68,0.06); }
.einbox-prev-action-btn.danger:hover { background: rgba(239,68,68,0.15); }

/* --- Draft Section in Preview --- */
.einbox-draft-section {
  margin: 0;
  padding: 16px 24px;
  background: rgba(234, 179, 8, 0.06);
  border-top: 2px solid #eab308;
  border-bottom: 1px solid rgba(234,179,8,0.15);
}

.einbox-draft-hdr {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #eab308;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.einbox-draft-body {
  font-size: 13px;
  color: #e8e8ec;
  line-height: 1.6;
  white-space: pre-wrap;
  padding: 12px;
  background: rgba(0,0,0,0.3);
  border-radius: 6px;
  margin-bottom: 12px;
}

.einbox-draft-textarea {
  width: 100%;
  background: rgba(20,20,28,0.9);
  border: 1px solid rgba(212,175,55,0.2);
  color: #e8e8ec;
  padding: 12px;
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.5;
  font-family: inherit;
  resize: vertical;
  outline: none;
  margin-bottom: 12px;
  box-sizing: border-box;
}
.einbox-draft-textarea:focus { border-color: rgba(212,175,55,0.4); }

.einbox-draft-acts {
  display: flex;
  gap: 10px;
}

.einbox-draft-approve {
  background: rgba(34,197,94,0.15);
  border: 1px solid rgba(34,197,94,0.3);
  color: #22c55e;
  padding: 7px 20px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
}
.einbox-draft-approve:hover { background: rgba(34,197,94,0.25); }

.einbox-draft-edit {
  background: rgba(234,179,8,0.12);
  border: 1px solid rgba(234,179,8,0.3);
  color: #eab308;
  padding: 7px 20px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
}
.einbox-draft-edit:hover { background: rgba(234,179,8,0.2); }

.einbox-draft-reject {
  background: rgba(239,68,68,0.08);
  border: 1px solid rgba(239,68,68,0.2);
  color: #ef4444;
  padding: 7px 20px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
}
.einbox-draft-reject:hover { background: rgba(239,68,68,0.15); }

/* --- Message Body --- */
.einbox-prev-body {
  padding: 20px 24px;
  font-size: 13px;
  line-height: 1.7;
  color: #d0d0d5;
  white-space: pre-wrap;
  word-wrap: break-word;
}

/* --- Attachments --- */
.einbox-prev-attachments {
  padding: 14px 24px;
  border-top: 1px solid rgba(212,175,55,0.08);
}

.einbox-prev-att-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #8a8a95;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.einbox-att-item {
  font-size: 12px;
  color: #a8a8b5;
  padding: 4px 0;
}

/* --- Empty / Loading / Error --- */
.einbox-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 40px;
  color: #5a5a65;
  font-size: 13px;
}

.einbox-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 200px;
  color: #4a4a5a;
  font-size: 14px;
  font-style: italic;
}

.einbox-error {
  padding: 20px;
  color: #ef4444;
  font-size: 13px;
  text-align: center;
}

/* --- Compose Modal --- */
.einbox-compose-modal {
  position: fixed;
  inset: 0;
  z-index: 600;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
}

.einbox-compose-inner {
  background: #0e0e16;
  border: 1px solid rgba(212,175,55,0.2);
  border-radius: 12px;
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.einbox-compose-title {
  font-size: 16px;
  font-weight: 700;
  color: #e8c07a;
  margin-bottom: 16px;
  letter-spacing: 1px;
}

.einbox-compose-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.einbox-compose-row label {
  font-size: 12px;
  font-weight: 600;
  color: #8a8a95;
  width: 55px;
  flex-shrink: 0;
}

.einbox-compose-select,
.einbox-compose-input {
  flex: 1;
  background: rgba(20,20,28,0.9);
  border: 1px solid rgba(212,175,55,0.15);
  color: #e8e8ec;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  outline: none;
  font-family: inherit;
}
.einbox-compose-select:focus,
.einbox-compose-input:focus { border-color: rgba(212,175,55,0.4); }

.einbox-compose-body {
  width: 100%;
  background: rgba(20,20,28,0.9);
  border: 1px solid rgba(212,175,55,0.15);
  color: #e8e8ec;
  padding: 12px;
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.5;
  font-family: inherit;
  resize: vertical;
  outline: none;
  margin-bottom: 16px;
  box-sizing: border-box;
}
.einbox-compose-body:focus { border-color: rgba(212,175,55,0.4); }

.einbox-compose-btns {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.einbox-compose-send {
  background: rgba(212,175,55,0.2);
  border: 1px solid rgba(212,175,55,0.4);
  color: #d4af37;
  padding: 8px 28px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}
.einbox-compose-send:hover { background: rgba(212,175,55,0.3); }
.einbox-compose-send:disabled { opacity: 0.5; cursor: not-allowed; }

.einbox-compose-cancel {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.1);
  color: #8a8a95;
  padding: 8px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}
.einbox-compose-cancel:hover { border-color: rgba(255,255,255,0.2); }

/* --- Toast Notice --- */
.einbox-notice {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(34,197,94,0.15);
  border: 1px solid rgba(34,197,94,0.3);
  color: #22c55e;
  padding: 10px 24px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  z-index: 9999;
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
}
.einbox-notice.error {
  background: rgba(239,68,68,0.15);
  border-color: rgba(239,68,68,0.3);
  color: #ef4444;
}
.einbox-notice.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* --- Responsive --- */
@media (max-width: 768px) {
  .einbox-split { flex-direction: column; }
  .einbox-list { width: 100%; max-width: none; min-width: 0; border-right: none; border-bottom: 1px solid rgba(212,175,55,0.1); max-height: 45vh; }
  .einbox-preview { min-height: 40vh; }
  .einbox-header { flex-wrap: wrap; gap: 8px; }
  .einbox-search-wrap { max-width: none; order: 10; flex-basis: 100%; }
  .einbox-account-label { max-width: none; }
  .einbox-row-actions { opacity: 1; }
}

@media (max-width: 480px) {
  .einbox-tabs { padding: 0 8px; }
  .einbox-tab { padding: 8px 10px; font-size: 10px; letter-spacing: 1px; }
  .einbox-prev-header { padding: 14px 16px; }
  .einbox-prev-body { padding: 14px 16px; }
}
