* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, "Segoe UI", Arial, sans-serif; color: #0B1B3A; color-scheme: light; background: #fff; }
.muted { color: #6B7280; }
button {
  font-family: inherit; cursor: pointer; border: 1px solid #E2E5EA; background: #fff;
  border-radius: 8px; padding: 8px 14px; font-size: 13.5px; color: #0B1B3A;
}
button:hover { background: #F4F6FA; }
button:disabled { opacity: .4; cursor: not-allowed; }
button:disabled:hover { background: #fff; }
.btn-accent { background: #2F5FEA; color: #fff; border-color: #2F5FEA; }
.btn-accent:hover { background: #244BBC; }
.btn-full { width: 100%; }
input, textarea {
  font-family: inherit; padding: 8px 10px; border: 1px solid #E2E5EA; border-radius: 6px; font-size: 13.5px; width: 100%;
  background-color: #FFFFFF; color: #0B1B3A; color-scheme: light;
}
input::placeholder, textarea::placeholder { color: #9CA3AF; }
label { font-size: 12px; color: #6B7280; }

/* Login (igual que calendar-app) */
.login-page { display: flex; align-items: center; justify-content: center; height: 100vh; background: #0B1B3A; }
.login-box { background: #fff; padding: 40px; border-radius: 12px; width: 320px; text-align: center; }
.login-box h1 { margin-bottom: 0; }
.login-box form { display: flex; flex-direction: column; text-align: left; margin-top: 20px; gap: 4px; }
.login-box label { margin-top: 8px; }
.login-box button { margin-top: 16px; }
.error { color: #D85A30; font-size: 13px; min-height: 18px; }

/* Layout principal */
.webmail { display: flex; height: 100vh; background: #F4F6FA; }
.folders-col { width: 200px; flex-shrink: 0; background: #fff; border-right: 1px solid #E2E5EA; padding: 16px; display: flex; flex-direction: column; }
.folders-list { margin-top: 16px; flex: 1; }
.folder-item { padding: 9px 12px; border-radius: 6px; font-size: 13.5px; color: #6B7280; cursor: pointer; margin-bottom: 2px; }
.folder-item.active { background: #E6EDFD; color: #1E41A3; font-weight: 600; }
.logout-link { border: none; background: none; color: #6B7280; text-align: left; padding: 8px 12px; }
.calendar-link { display: block; padding: 8px 12px; font-size: 13.5px; color: #6B7280; text-decoration: none; border-top: 1px solid #E2E5EA; margin-top: 8px; padding-top: 14px; }
.calendar-link:hover { color: #2F5FEA; }

.messages-col { width: 340px; flex-shrink: 0; background: #fff; border-right: 1px solid #E2E5EA; display: flex; flex-direction: column; }
.search-bar { padding: 12px; border-bottom: 1px solid #E2E5EA; }
.messages-list { flex: 1; overflow-y: auto; }
.message-row { padding: 12px 16px; border-bottom: 1px solid #E2E5EA; cursor: pointer; }
.message-row:hover { background: #F4F6FA; }
.message-row.active { background: #E6EDFD; }
.message-row.unread .msg-from, .message-row.unread .msg-subject { font-weight: 700; }
.msg-top { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 3px; }
.msg-from { color: #0B1B3A; }
.msg-time { color: #A9B0BE; font-size: 11px; }
.msg-subject { font-size: 12.5px; color: #374151; margin-bottom: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.loading, .empty-state { padding: 60px 24px; text-align: center; color: #6B7280; }
.pagination { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; border-top: 1px solid #E2E5EA; font-size: 12.5px; }

.reading-col { flex: 1; overflow-y: auto; padding: 28px; }
.reading-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 16px; padding-bottom: 16px; border-bottom: 1px solid #E2E5EA; }
.reading-header h2 { margin: 0 0 6px; font-size: 19px; }
.reading-meta { font-size: 13px; color: #6B7280; }
.reading-actions { display: flex; gap: 8px; }
.reading-actions .btn-with-label { width: auto; height: auto; padding: 8px 14px; white-space: nowrap; }
.reading-body { font-size: 14.5px; line-height: 1.7; }
.reading-body img { max-width: 100%; }
.attachment-chip { display: inline-flex; align-items: center; gap: 8px; background: #F4F6FA; border-radius: 8px; padding: 8px 12px; font-size: 12.5px; margin: 6px 6px 0 0; cursor: pointer; }

/* Ventana de redactar flotante */
.compose-window {
  position: fixed; bottom: 0; right: 40px; width: 480px; background: #fff;
  border-radius: 10px 10px 0 0; box-shadow: 0 -8px 32px rgba(11,27,58,.2); z-index: 60;
  display: flex; flex-direction: column; max-height: 80vh;
}
.compose-window.hidden { display: none; }
.compose-header { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; background: #0B1B3A; color: #fff; border-radius: 10px 10px 0 0; font-size: 13px; }
.compose-header-actions { display: flex; gap: 14px; }
.icon-btn-flat { cursor: pointer; opacity: .8; }
.icon-btn-flat:hover { opacity: 1; }
.compose-body { padding: 0 14px; overflow-y: auto; flex: 1; }
.compose-field { display: flex; align-items: center; border-bottom: 1px solid #E2E5EA; padding: 8px 0; gap: 8px; }
.compose-field input { border: none; padding: 2px; flex: 1; }
.compose-label { font-size: 13px; color: #6B7280; width: 32px; flex-shrink: 0; }
.compose-toggle { font-size: 12px; color: #2F5FEA; cursor: pointer; flex-shrink: 0; }
.compose-toolbar { display: flex; gap: 2px; padding: 8px 0; border-bottom: 1px solid #E2E5EA; }
.compose-toolbar button, .attach-btn { width: 30px; height: 30px; padding: 0; display: flex; align-items: center; justify-content: center; border: none; background: none; border-radius: 6px; cursor: pointer; }
.compose-toolbar button:hover, .attach-btn:hover { background: #F4F6FA; }
.tb-sep { width: 1px; background: #E2E5EA; margin: 4px 6px; }
.compose-editable { min-height: 140px; padding: 12px 0; font-size: 13.5px; line-height: 1.6; outline: none; background: #FFFFFF; color: #0B1B3A; }
.attachments-preview { display: flex; flex-wrap: wrap; gap: 8px; padding-bottom: 12px; }
.attachment-tag { display: flex; align-items: center; gap: 6px; background: #F4F6FA; border-radius: 8px; padding: 6px 10px; font-size: 12px; }
.attachment-tag .remove { cursor: pointer; color: #6B7280; }
.compose-footer { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-top: 1px solid #E2E5EA; }
.hidden { display: none !important; }
.suggestions {
  position: absolute; top: 100%; left: 32px; right: 0; background: #fff;
  border: 1px solid #E2E5EA; border-radius: 8px; box-shadow: 0 8px 20px rgba(11,27,58,.12);
  z-index: 10; max-height: 180px; overflow-y: auto; margin-top: 2px;
}
.suggestion-item { padding: 8px 12px; font-size: 13px; cursor: pointer; }
.suggestion-item:hover { background: #F4F6FA; }
.hint { font-size: 12px; color: #6B7280; }
